public class JDK15RegexTranslator extends RegexTranslator
Modifier and Type | Class | Description |
---|---|---|
(package private) static class |
JDK15RegexTranslator.BackReference |
|
protected static class |
JDK15RegexTranslator.CharClass |
|
protected static class |
JDK15RegexTranslator.CharRange |
|
(package private) static class |
JDK15RegexTranslator.Complement |
|
(package private) static class |
JDK15RegexTranslator.Empty |
|
(package private) static class |
JDK15RegexTranslator.Property |
|
(package private) static class |
JDK15RegexTranslator.SimpleCharClass |
|
(package private) static class |
JDK15RegexTranslator.SingleChar |
|
(package private) static class |
JDK15RegexTranslator.Subtraction |
|
(package private) static class |
JDK15RegexTranslator.Union |
RegexTranslator.Range
Modifier and Type | Field | Description |
---|---|---|
static JDK15RegexTranslator.CharClass[] |
categoryCharClasses |
Translates XML Schema and XPath regexes into
java.util.regex regexes. |
static JDK15RegexTranslator.CharClass[] |
subCategoryCharClasses |
ALL, captures, caseBlind, curChar, currentCapture, eos, expandComplementBlockNames, ignoreWhitespace, inCharClassExpr, isXPath, isXPath30, length, NONE, NOT_ALLOWED_CLASS, pos, regExp, result, SOME, SURROGATES1_CLASS, SURROGATES2_CLASS, warnings, xmlVersion, xsdVersion
Modifier and Type | Method | Description |
---|---|---|
static void |
main(java.lang.String[] args) |
Main method for testing.
|
static java.lang.String |
translate(java.lang.CharSequence regExp,
int options,
int flagbits,
java.util.List<RegexSyntaxException> warnings) |
Translates a regular expression in the syntax of XML Schemas Part 2 into a regular
expression in the syntax of
java.util.regex.Pattern . |
protected boolean |
translateAtom() |
If what follows is an Atom, translate it and return true; otherwise return false
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
absorbSurrogatePair, advance, copyCurChar, expect, highSurrogateRanges, isAsciiAlnum, isJavaMetaChar, lowSurrogateRanges, makeException, makeException, parseQuantExact, recede, translateBranch, translateQuantifier, translateQuantity, translateRegExp, translateTop
public static final JDK15RegexTranslator.CharClass[] categoryCharClasses
java.util.regex
regexes.Pattern
,
XML Schema Part 2public static final JDK15RegexTranslator.CharClass[] subCategoryCharClasses
public static java.lang.String translate(java.lang.CharSequence regExp, int options, int flagbits, java.util.List<RegexSyntaxException> warnings) throws RegexSyntaxException
java.util.regex.Pattern
. The translation
assumes that the string to be matched against the regex uses surrogate pairs correctly.
If the string comes from XML content, a conforming XML parser will automatically
check this; if the string comes from elsewhere, it may be necessary to check
surrogate usage before matching.regExp
- a String containing a regular expression in the syntax of XML Schemas Part 2options
- bit-wise option settingsflagbits
- Java bit-wise options settings based on supplied flagswarnings
- a list to contain any warnings generated. If no list is supplied, this indicates
that the caller is not interested in knowing about any warnings.RegexSyntaxException
- if regexp
is not a regular expression in the
syntax of XML Schemas Part 2, or XPath 2.0, as appropriatePattern
,
XML Schema Part 2protected boolean translateAtom() throws RegexSyntaxException
RegexTranslator
translateAtom
in class RegexTranslator
RegexSyntaxException
- if the regex syntax is incorrectpublic static void main(java.lang.String[] args) throws RegexSyntaxException
args
- command line arguments
arg[0] a regular expression
arg[1] = xpath to invoke the XPath rulesRegexSyntaxException
- if the regex is invalid