public class SimplePatternParser extends Object
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 and Description |
---|
SimplePatternParser()
Creates a new
SimplePatternParser object. |
Modifier and Type | Method and Description |
---|---|
Pattern |
parseSimplePattern(String simplePattern)
Converts the specified simple pattern to a Perl 5 regular expression.
|
public SimplePatternParser()
SimplePatternParser
object.public Pattern 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.See http://www.xins.org/.