Skip to main content.
home | support | download

Back to List Archive

Re: Regex in ReplaceRules

From: Ed Burns <edburns(at)>
Date: Wed Nov 04 1998 - 01:29:37 GMT
On Tue, 3 November 17:12:22, Jeff Patterson wrote:
> Ed,
> I think your problem is with the forward slashes in front of the ( and )
> characters. Forward slashing a meta-character tells regexp to treat it like
> any other character. So unless your path name really does have a ( and a ) in
> it, your expression won't match.
> That aside, I think what you want is just to replace the top part of the
> path with the server name and leave everything else the same in which case
> just
> ReplaceRules replace "/usr/web/htdocs/" "http://host/cgi-bin/concordance/" 
> would work. If you really do want to for some reason to create misdirected
> links that collapse everything to one level try

They are not misdirected links, they point to a servlet that processes
an input file (which it knows how to find from the filename) and
generates some output.

> "/usr/web/htdocs/.*" "http://host/cgi-bin/concordance/"

> Since this is a regular expression and not a glob, the . is required
> before the *. The regexp .* reads zero or more occurances of any
> single character. The thing to remember about regexps is that the
> metas always modify the preceeding character.

> Hope this helps

Well, I tried it, and it didn't work.

ReplaceRules replace "/usr/web/htdocs/.*" "http://host/cgi-bin/concordance/"

% swish-e -c ./Spex.conf -v


% swish-e -f Spex.swish -w Resource


230 /usr/web/htdocs/Project/Resource_Loader/Viewpoint/0000001b.html "0000001b.html" 1978
162 /usr/web/htdocs/Project/Resource_Loader/Viewpoint/0000001a.html "0000001a.html" 2437

Instead of what I expected, which is:

230 http://host/cgi-bin/concordance/0000001b.html "0000001b.html" 1978
162 http://host/cgi-bin/concordance/0000001a.html "0000001a.html" 2437

Does anyone know how to get the desired behavior?


Received on Tue Nov 3 17:38:55 1998