|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knowceans.util.NamedGroupsRegex
public class NamedGroupsRegex
NamedGroupRegex allows to name groups in regular expressions, similar to python, but using simpler syntax:
({name}groupstring)
If an additional qualifier to the group is needed, such as multiline case
insensitive The substitution syntax is:
substitionst${name}ring
The following syntax can be used for back references:
({name}groupstring) ${name}
(Because of the string in braces, the $ can be disambiguated from the
end-of-line symbol.)
Usage: Before a pattern with named groups is used, a NamedGroupsDecoder
object is created for the pattern using
| Constructor Summary | |
|---|---|
NamedGroupsRegex(java.lang.String pattern)
Creates a decoder for a regex string |
|
NamedGroupsRegex(java.lang.String pattern,
java.lang.String replacement)
Creates a decoder for regex and replacement string |
|
| Method Summary | |
|---|---|
int |
getGroup(java.lang.String name)
|
java.util.regex.Pattern |
getJavaPattern()
Gets the complile pattern for the regex. |
java.lang.String |
getJavaPatternString()
get java-compliant regex string |
java.lang.String |
getJavaSub()
get java-compliant substitution / replacement string |
java.util.regex.Matcher |
getMatcher(java.lang.CharSequence seq)
Creates a matcher for the regex. |
static void |
main(java.lang.String[] args)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NamedGroupsRegex(java.lang.String pattern)
pattern -
public NamedGroupsRegex(java.lang.String pattern,
java.lang.String replacement)
pattern - replacement - | Method Detail |
|---|
public static void main(java.lang.String[] args)
public java.util.regex.Pattern getJavaPattern()
public java.util.regex.Matcher getMatcher(java.lang.CharSequence seq)
seq -
public final java.lang.String getJavaPatternString()
public final java.lang.String getJavaSub()
public final int getGroup(java.lang.String name)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||