Skip to main content.
home | support | download

Back to List Archive

Re: New behaviour of ReplaceRules

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Mon Dec 24 2001 - 16:23:23 GMT
At 01:29 AM 12/24/2001 -0800, Jean-François PIÉRONNE wrote:

>using the latest snapshot, i have found that ReplaceRules don't work as
>previously:
>
>I have a, in my config file,the following rule
>ReplaceRules replace "/disk$docs\$docs/www/" "/docs"
>
>using the latest version the rule dont work, i have had to update it to
>ReplaceRules replace "/disk$docs\\$docs/www/" "/docs"
>
>Is this the expected behaviour or is this a bug ?

Expected.  It's fixing a bug in the old code.  But I need to update
CHANGES, thanks.

The backslash escapes the next character, so to place a backslash in the
string you need double backslash.

>I have also made the same modification (replace all '\' by '\\') to my config
>file for the rules 
>NoContents and
>FileRules filename contains

Actually, I think it's probably everything.  The config file is parsed into
"words" using parse_line() which calls getword().  getword() was the
modified function.

So you can even specify directives that way (although I'm not sure why):

    \F\i\l\e\F\i\l\t\e\r .html pdftotext "'%p' -"

If you look at older (pre Nov 9th) string.c you can see where it failed to
look for end quotes plus it had code to check and escape the backslash but
it didn't work.

Anyway, the \ is used to backslash the next char, and you can use either
single or double quotes to quote a token (word) that contains spaces.



Bill Moseley
mailto:moseley@hank.org
Received on Mon Dec 24 16:23:43 2001