org.comedia.util
Class CRegExp
java.lang.Object
|
+--org.comedia.util.CRegExp
- public class CRegExp
- extends java.lang.Object
Implements regular expressions algorithms.
It allows unix grep-like pattern comparisons, for instance:
- ? - Matches any single characer
- * - Matches any contiguous characters
- [abc] - Matches a or b or c at that position
- [^abc] - Matches anything but a or b or c at that position
- [!abc] - Ditto
- [a-e] - Matches a through e at that position
Usage examples:
System.out.println("Match result: "
+ CRegExp.isMatch("[A-Z,_]*[A-Z,0-9,_]*0?7*", "LAB_001"));
Method Summary |
static boolean |
isMatch(java.lang.String pattern,
java.lang.String text)
Matches a text after star (any sequence). |
static void |
main(java.lang.String[] args)
Runs the test for this class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CRegExp
public CRegExp()
isMatch
public static boolean isMatch(java.lang.String pattern,
java.lang.String text)
- Matches a text after star (any sequence).
- Parameters:
pattern
- a regular expression pattern.text
- a text to match.
main
public static void main(java.lang.String[] args)
- Runs the test for this class.
- Parameters:
args
- a command line arguments.