org.exist.xquery.util
Class RegexTranslator
java.lang.Object
org.exist.xquery.util.RegexTranslator
public class RegexTranslator
- extends Object
This class translates XML Schema regex syntax into JDK 1.4 regex syntax.
Copied from Saxon package net.sf.saxon.type without change. The original
author is James Clark. See license.
|
Method Summary |
static void |
main(String[] args)
|
static String |
translate(String 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. |
translate
public static String translate(String regexp,
boolean xpath)
throws RegexTranslator.RegexSyntaxException
- Translates a regular expression in the syntax of XML Schemas Part 2 into a regular
expression in the syntax of
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.
- Parameters:
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 permitted
- Returns:
- a String containing a regular expression in the syntax of java.util.regex.Pattern
- Throws:
RegexTranslator.RegexSyntaxException - if regexp is not a regular expression in the
syntax of XML Schemas Part 2- See Also:
Pattern,
XML Schema Part 2
main
public static void main(String[] args)
throws RegexTranslator.RegexSyntaxException
- Throws:
RegexTranslator.RegexSyntaxException
Copyright (C) Wolfgang Meier. All rights reserved.