|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.text.SimplePatternParser
Simple pattern parser.
A simple pattern is a text string that may contain letters, digits,
underscores, hyphens, dots and the wildcard characters '*'
(asterisk) and '?'
(question mark).
The location of an asterisk indicates any number of characters is allowed. The location of a question mark indicates exactly one character is expected.
To allow matching of simple patterns, a simple pattern is first compiled
into a Perl 5 regular expression. Every asterisk is converted to
".*"
, while every question mark is converted to
"."
.
Examples of conversions from a simple pattern to a Perl 4 regular expression:
Simple pattern | Perl 5 regex equivalent |
---|---|
* | .* |
? | . |
_Get* | _Get.* |
_Get*i?n | _Get.*i.n |
*on | .*on |
_Get*,_Dis* | _Get.*|_Dis.* |
Constructor Summary | |
SimplePatternParser()
Creates a new SimplePatternParser object. |
Method Summary | |
Perl5Pattern |
parseSimplePattern(String simplePattern)
Converts the specified simple pattern to a Perl 5 regular expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimplePatternParser()
SimplePatternParser
object.
Method Detail |
public Perl5Pattern parseSimplePattern(String simplePattern) throws IllegalArgumentException, ParseException
simplePattern
- the simple pattern, cannot be null
.
null
.
IllegalArgumentException
- if simplePattern == null
.
ParseException
- if provided simplePattern is invalid or could not be parsed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |