Skip to main content.
home | support | download

Back to List Archive

Re: Swish Dev 2.1dev24build win replace rules

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Thu Feb 07 2002 - 06:01:05 GMT
At 09:10 PM 02/06/02 -0800, Sundaram Balasubramaninan wrote:
>Hi
>
>When we try to index one directory say C:\aa\bb with
>the index command line as
>swishe -i C:\aa\bb -f out.swish
>leading to produce file name of the pattern
>C:\aa\bb\xx.htm
>
>To replace this path as a url, we give
>ReplaceRules "C:\aa\bb\" "http://localhost/ss/"

>If we add this replace rule index fails.

Fails is a big word.  

When I tried:

  ReplaceRules "C:\\aa\\bb\\" "http://localhost/ss/"

I got

  err: Failed to compile regular expression 'C:\home\', pattern. Error: 5

Which made me realize the problem.  See that trailing slash.  What's it
escaping?  That's making the regex library puke.>How to overcome?

>How to overcome?

  ReplaceRules "C:\\\\aa\\\\bb\\\\" "http://localhost/ss/"

Argh, no wonder we don't like dos path names!

Why does that work?  Well, because swish uses backslash to escape the next
char.  If you want a backslash you need two.  So swish converts that to:

  ReplaceRules "C:\\aa\\bb\\" "http://localhost/ss/"

But, since that goes on to be a compiled regular expression, we have yet
another level of escaping in the regex library.  So the regex library
converts it to:

  ReplaceRules "C:\aa\bb\" "http://localhost/ss/"


That alone should be enough to make you convert to another OS.




-- 
Bill Moseley
mailto:moseley@hank.org
Received on Thu Feb 7 06:01:35 2002