|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eel.kitchen.util.RhinoHelper
public final class RhinoHelper
ECMA 262 validation helper. Rhino is used instead of
java.util.regex because the latter doesn't comply with ECMA 262:
Pattern.DOTALL;++,
?+, etc);\b;
\< (for beginning of word) and \> (for end
of word) are not understood.
And many, many other things. See here for the full story. And if you don't yet have Jeffrey Friedl's "Mastering regular expressions", just buy it :p
| Constructor Summary | |
|---|---|
RhinoHelper()
|
|
| Method Summary | |
|---|---|
static boolean |
regexIsValid(String regex)
Validate that a regex is correct |
static boolean |
regMatch(String regex,
String input)
Matches an input against a given regex, in the real sense of matching, that is, the regex can match anywhere in the input. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RhinoHelper()
| Method Detail |
|---|
public static boolean regexIsValid(String regex)
regex - the regex to validate
public static boolean regMatch(String regex,
String input)
Matches an input against a given regex, in the real sense
of matching, that is, the regex can match anywhere in the input.
Java's java.util.regex makes the unfortunate mistake to make
people believe that matching is done on the whole input... Which is
not true.
Also note that the regex MUST have been validated at this point
(using regexIsValid(String)).
regex - the regex to useinput - the input to match against (and again, see description)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||