You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by ru...@us.ibm.com on 2000/07/30 00:50:24 UTC

Matching dots - how?


How does one match dots in match patterns?  If you put a dot in the string,
it will match any character.  Putting a backslash before the dot causes
errors...

- Sam Ruby



Re: Matching dots - how?

Posted by Giacomo Pati <Gi...@pwr.ch>.
Giacomo Pati wrote:
> 
> rubys@us.ibm.com wrote:
> >
> > How does one match dots in match patterns?  If you put a dot in the string,
> > it will match any character.  Putting a backslash before the dot causes
> > errors...
> 
> Yes, I know. Java is very picky about escaping. It wouldn't let you
> escape a char that doesn't need to (in sense of Java Strings because it
> doesn't know about regexp). I have no workaround at the moment but will
> think about it. Maybe escaping the backslash like
> 
>    pattern="^(.*)\\.xml$"
> 
> will help (if the matcher/selector is able to recognise this).

I've commited a patch that will enable the use of patterns for the
uri-regexp matcher to be like proposed above.

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: Matching dots - how?

Posted by Giacomo Pati <Gi...@pwr.ch>.
rubys@us.ibm.com wrote:
> 
> How does one match dots in match patterns?  If you put a dot in the string,
> it will match any character.  Putting a backslash before the dot causes
> errors...

Yes, I know. Java is very picky about escaping. It wouldn't let you
escape a char that doesn't need to (in sense of Java Strings because it
doesn't know about regexp). I have no workaround at the moment but will
think about it. Maybe escaping the backslash like 

   pattern="^(.*)\\.xml$" 

will help (if the matcher/selector is able to recognise this).

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch