Package xmlschema_acue :: Module regex

Module regex

source code

Parse and translate XML regular expressions to Python regex syntax.

Classes
  XsdRegexCharGroup
A set subclass to represent XML Schema regex character groups.
Functions
 
get_unicode_subset(key) source code
 
parse_character_class(xml_regex, class_pos)
Parses a character class of an XML Schema regular expression.
source code
 
get_python_regex(xml_regex)
Translates an XML regex expression to a Python compatible expression.
source code
Variables
  I_SHORTCUT_REPLACE = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿" "‌-‍⁰-↏Ⰰ-⿯、-퟿豈-...
  C_SHORTCUT_REPLACE = "-.0-9:A-Z_a-z·À-ÖØ-öø-ͽͿ-῿‌-" "‍‿⁀⁰-↏Ⰰ-⿯...
  S_SHORTCUT_SET = UnicodeSubset...
  D_SHORTCUT_SET = UnicodeSubset('0-9')
  I_SHORTCUT_SET = UnicodeSubset(I_SHORTCUT_REPLACE)
  C_SHORTCUT_SET = UnicodeSubset(C_SHORTCUT_REPLACE)
  W_SHORTCUT_SET = UnicodeSubset()
  CHARACTER_ESCAPES = {'\n'...
Function Details

parse_character_class(xml_regex, class_pos)

source code 

Parses a character class of an XML Schema regular expression.

:param xml_regex: the source XML Schema regular expression. :param class_pos: the position of the character class in the source string, must coincide with a '[' character. :return: an `XsdRegexCharGroup` instance and the first position after the character class.

Decorators:

Variables Details

I_SHORTCUT_REPLACE

Value:
":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿" "‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"

C_SHORTCUT_REPLACE

Value:
"-.0-9:A-Z_a-z·À-ÖØ-öø-ͽͿ-῿‌-" "‍‿⁀⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"

S_SHORTCUT_SET

Value:
UnicodeSubset(' 
	
')

CHARACTER_ESCAPES

Value:
{'\n': '
', '\r': '
', '\t': '	', '\|': '|', '\.': '.', '\-': '-', '\^': '^', '\
\?': '?', '\*': '*', '\+': '+', '\{': '{', '\}': '}', '\(': '(', '\)':\
 ')', '\[': '[', '\]': ']', '\\': '\', '\s': S_SHORTCUT_SET, '\S': S_S\
HORTCUT_SET, '\d': D_SHORTCUT_SET, '\D': D_SHORTCUT_SET, '\i': I_SHORT\
CUT_SET, '\I': I_SHORTCUT_SET, '\c': C_SHORTCUT_SET, '\C': C_SHORTCUT_\
SET, '\w': W_SHORTCUT_SET, '\W': W_SHORTCUT_SET,}