public class JDK14RegexTranslator extends SurrogateRegexTranslator
SurrogateRegexTranslator.BackReference, SurrogateRegexTranslator.CharClass, SurrogateRegexTranslator.CharRange, SurrogateRegexTranslator.Complement, SurrogateRegexTranslator.Dot, SurrogateRegexTranslator.Empty, SurrogateRegexTranslator.Property, SurrogateRegexTranslator.SimpleCharClass, SurrogateRegexTranslator.SingleChar, SurrogateRegexTranslator.WideSingleChar
RegexTranslator.Range
categoryCharClasses, subCategoryCharClasses
ALL, captures, caseBlind, curChar, currentCapture, eos, ignoreWhitespace, inCharClassExpr, isXPath, length, NONE, NOT_ALLOWED_CLASS, pos, regExp, result, SOME, SURROGATES1_CLASS, SURROGATES2_CLASS, xmlVersion
?????? |
---|
JDK14RegexTranslator()
Create a regex translator for JDK 1.4
|
?????? | ????? |
---|---|
static void |
main(java.lang.String[] args)
Diagnostic entry point
|
void |
setIgnoreWhitespace(boolean ignore)
Indicate whether whitespace should be ignored
|
java.lang.String |
translate(java.lang.CharSequence regExp,
int xmlVersion,
boolean xpath)
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() |
absorbSurrogatePair, advance, copyCurChar, expect, highSurrogateRanges, isAsciiAlnum, isBlock, isJavaMetaChar, lowSurrogateRanges, makeException, makeException, parseQuantExact, recede, sortRangeList, translateBranch, translateQuantifier, translateQuantity, translateRegExp, translateTop
public void setIgnoreWhitespace(boolean ignore)
ignore
- true if whitespace should be ignoredpublic java.lang.String translate(java.lang.CharSequence regExp, int xmlVersion, boolean xpath) 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 2xmlVersion
- integer constant indicating XML 1.0 or XML 1.1xpath
- a boolean indicating whether the XPath 2.0 F+O extensions to the schema
regex syntax are permittedRegexSyntaxException
- 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
translateAtom
??? RegexTranslator
RegexSyntaxException
public static void main(java.lang.String[] args) throws RegexSyntaxException
args
- argument 1 - XPath regex; argument 2 - xpath|xmlschemaRegexSyntaxException