Regular Expression reserved letters
- From: adrianae@xxxxxx
- Date: 30 Apr 2007 07:18:26 -0700
Hi all
I have the following problem.
I have to test if a text matches with another text. For this i use the
matches-Method of the String class in the way:
String a = "Hello world";
String b = "anytext goes here_-)_some m[]ore text goes{}here.";
if (a.tolowercase().matches(b)) {
// some code goes here
}
The problem ist, that e.g. ),[],{} are reserved words in regex. To use
them in filter expressions i have to escape them with \). But how to
know what all i have to escape? There are so many other reserved
letters and signs in regex and the text i have to compare can contain
everything.
So my questions:
Is there in any class any helper function which knows all the reserved
sings and letters and that supplies a function which escapes me all
automatically?
Thank you
Adrian
.
- Follow-Ups:
- Re: Regular Expression reserved letters
- From: Daniel Pitts
- Re: Regular Expression reserved letters
- From: Chris Dollin
- Re: Regular Expression reserved letters
- Prev by Date: Eclipse ant file not compiling
- Next by Date: can't show a Set in dataTable (JSF)
- Previous by thread: Eclipse ant file not compiling
- Next by thread: Re: Regular Expression reserved letters
- Index(es):