public class JDK15RegexTranslator extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
JDK15RegexTranslator.BackReference |
(package private) static class |
JDK15RegexTranslator.CharClass |
(package private) 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.Range |
(package private) static class |
JDK15RegexTranslator.SimpleCharClass |
(package private) static class |
JDK15RegexTranslator.SingleChar |
(package private) static class |
JDK15RegexTranslator.Subtraction |
(package private) static class |
JDK15RegexTranslator.Union |
Modifier and Type | Field and Description |
---|---|
(package private) static int |
ALL |
(package private) static String |
CATEGORY_NAMES |
(package private) static int[][] |
CATEGORY_RANGES |
(package private) static String |
NMCHAR_CATEGORIES |
(package private) static String |
NMCHAR_EXCLUDE_RANGES |
(package private) static String |
NMCHAR_INCLUDES |
(package private) static String |
NMSTRT_CATEGORIES |
(package private) static String |
NMSTRT_EXCLUDE_RANGES |
(package private) static String |
NMSTRT_INCLUDES |
(package private) static int |
NONE |
(package private) static String |
NOT_ALLOWED_CLASS |
(package private) static int |
SOME |
(package private) static String |
SURROGATES1_CLASS |
(package private) static String |
SURROGATES2_CLASS |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args) |
static String |
translate(CharSequence regexp,
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 . |
static final String CATEGORY_NAMES
static final int[][] CATEGORY_RANGES
static final String NMSTRT_INCLUDES
static final String NMSTRT_EXCLUDE_RANGES
static final String NMSTRT_CATEGORIES
static final String NMCHAR_INCLUDES
static final String NMCHAR_EXCLUDE_RANGES
static final String NMCHAR_CATEGORIES
static final int NONE
static final int SOME
static final int ALL
static final String SURROGATES1_CLASS
static final String SURROGATES2_CLASS
static final String NOT_ALLOWED_CLASS
public static String translate(CharSequence regexp, 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 2xpath
- 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 2public static void main(String[] args) throws RegexSyntaxException
RegexSyntaxException