|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.text.pattern.Pattern2
public final class Pattern2
This class extends the concepts of the JDK java.util.regex.Pattern class with a new WILDCARD compilation flag, which modifies the pattern compilation such that it combines the well-known
wildcard pattern matching with the power of regular
expressions.
compile(String, int)| Field Summary | |
|---|---|
static int |
WILDCARD
Modifies the pattern compilation as follows: The meaning of the '*' and '?' |
| Method Summary | |
|---|---|
static java.util.regex.Pattern |
compile(java.lang.String pattern,
int flags)
Like Pattern.compile(String,int), but with support for the WILDCARD flag. |
static int |
findMeta(java.lang.String metaCharacters,
java.lang.String subject,
int offset)
Finds the next unescaped occurrence of one of the metaCharacters within subject, starting at
position offset. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int WILDCARD
The meaning of the '*' and '?' metacharacters is now different, and '.' is no longer a metacharacter.
'/' is now a metacharacter, i.e. to include it literally in the pattern, it must be escaped with a backslash.
The semantics of '*', '?' and '.' are as follows:
| Construct | Matches |
|---|---|
| Wildcards | |
| * | Zero or more characters except '/', the file separator and '!' |
| ** | Zero or more characters except '!' |
| *** | Zero or more characters |
| ? | Any character except '/', the file separator and '!' |
| . | The '.' |
| / |
'/' or the system-dependent file separator (see separatorChar)
|
{0,}'. Similarly, to quantify 'zero or one', you can no longer write '?', but
must use '{0,1}'.
| Method Detail |
|---|
public static java.util.regex.Pattern compile(java.lang.String pattern,
int flags)
Pattern.compile(String,int), but with support for the WILDCARD flag.
WILDCARD,
Pattern.CANON_EQ,
Pattern.CASE_INSENSITIVE,
Pattern.COMMENTS,
Pattern.DOTALL,
Pattern.LITERAL,
Pattern.MULTILINE,
Pattern.UNICODE_CASE,
Pattern.UNIX_LINES
public static int findMeta(java.lang.String metaCharacters,
java.lang.String subject,
int offset)
metaCharacters within subject, starting at
position offset. Metacharacters can be escaped by backslashes or by '\Q ... \E'.
subject.length() iff no meta character is found
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||