reqrep always replaces, even when position \x is not found?

From: Pedro Mata-Mouros Fonseca <pedro.matamouros#sapo.pt>
Date: Fri, 21 Aug 2009 12:19:50 +0100


Greetings,

I'm using a reqrep to search in a URI for either the "rss" or "rss2" strings. The objective is to have the following mapping:
/rss?u=username => /Endpoint/RSS?u=username
/rss2?u=username => /Endpoint/RSS2?u=username

This is the reqrep I'm using:

reqrep ^([^\ ]*)\ /rss(2*)(.*)                \1\ /Endpoint/RSS\2\3

This is the result:
10.134.15.124 - - [21/Aug/2009:12:08:33 +0100] "GET /Endpoint/RSS2? u=username HTTP/1.1" 404 209
10.134.15.124 - - [21/Aug/2009:12:09:05 +0100] "GET /Endpoint/RSS1? u=username HTTP/1.1" 404 209

When \2 exists, it is replaced accordingly, but when it doesn't a 1 is used for replacement, instead of an empty string... Any ideas of what could be happening?

(Note that each return a 404, because there's not really any content - this was just to test the regexp replacement.)

Thanks so much.

Pedro. Received on 2009/08/21 13:19

This archive was generated by hypermail 2.2.0 : 2009/08/21 13:30 CEST