net.sf.saxon.dotnet
public class DotNetRegexTranslator 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
Constructor and Description |
---|
DotNetRegexTranslator()
Create a regular expression translator for the .NET platform
|
Modifier and Type | Method and Description |
---|---|
int |
getNumberOfCapturedGroups()
Get the number of captured groups for this regular expression
|
static void |
main(java.lang.String[] args)
Convenience main method for testing purposes.
|
java.lang.String |
translate(java.lang.CharSequence regExp,
int xmlVersion,
boolean xpath,
boolean ignoreWhitespace,
boolean caseBlind)
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 DotNetRegexTranslator()
public java.lang.String translate(java.lang.CharSequence regExp, int xmlVersion, boolean xpath, boolean ignoreWhitespace, boolean caseBlind) 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
- the version of XML in use - this affects the meanings of the \i and \c character
class escapesxpath
- a boolean indicating whether the XPath 2.0 F+O extensions to the schema
regex syntax are permittedignoreWhitespace
- true if the x flag is set, allowing ignorable whitespace in the regexcaseBlind
- true if the i flag is set, allowing case blind comparisonsRegexSyntaxException
- if regexp
is not a regular expression in the
syntax of XML Schemas Part 2, or XPath 2.0, as appropriatePattern
,
XML Schema Part 2public int getNumberOfCapturedGroups()
protected boolean translateAtom() throws RegexSyntaxException
translateAtom
in class RegexTranslator
RegexSyntaxException
public static void main(java.lang.String[] args) throws RegexSyntaxException
args:
- (1) the regex, (2) xpath|schema, (3) target string to be matchedRegexSyntaxException