Table of contents
Appendices
|
D Regular ExpressionsRegular Expressions
XML Schema's
pattern facet uses a regular expression language
that supports [
Unicode]. It is fully described in [
XML Schema Part 2]. The language is similar to the
regular expression language used in the Perl
Programming language, although expressions are matched
against entire lexical representations rather than
user-scoped lexical representations such as line and
paragraph. For this reason, the expression language does
not contain the metacharacters ^ and $, although ^ is used
to express exception, e.g. [^0-9]x.
regexTable2100%regex examples
Table D1. Examples of Regular Expressions
| 11Expression |
11Match(es) |
| 11Chapter \d |
11Chapter 0, Chapter 1, Chapter 2 .... |
| 11Chapter\s\d |
11Chapter followed by a single whitespace character
(space, tab, newline, etc.), followed by a single
digit |
| 11Chapter\s\w |
11Chapter followed by a single whitespace character
(space, tab, newline, etc.), followed by a word
character (XML 1.0
Letter or Digit) |
| 11Espanñola |
11Española |
| 11\p{Lu} |
11any uppercase character, the value of \p{} (e.g.
"Lu") is defined by [Unicode] |
| 11\p{IsGreek} |
11any Greek character, the 'Is' construction may be
applied to any block name (e.g. "Greek") as defined
by [Unicode] |
| 11\P{IsGreek} |
11any non-Greek character, the 'Is' construction may be
applied to any block name (e.g. "Greek") as defined
by [Unicode] |
| 11a*x |
11x, ax, aax, aaax .... |
| 11a?x |
11ax, x |
| 11a+x |
11ax, aax, aaax .... |
| 11(a|b)+x |
11ax, bx, aax, abx, bax, bbx, aaax, aabx, abax, abbx,
baax, babx, bbax, bbbx, aaaax .... |
| 11[abcde]x |
11ax, bx, cx, dx, ex |
| 11[a-e]x |
11ax, bx, cx, dx, ex |
| 11[\-ae]x |
11-x, ax, ex |
| 11[ae\-]x |
11ax, ex, -x |
| 11[^0-9]x |
11any non-digit character followed by the character x |
| 11\Dx |
11any non-digit character followed by the character x |
| 11.x |
11any character followed by the character x |
| 11.*abc.* |
111x2abc, abc1x2, z3456abchooray .... |
| 11ab{2}x |
11abbx |
| 11ab{2,4}x |
11abbx, abbbx, abbbbx |
| 11ab{2,}x |
11abbx, abbbx, abbbbx .... |
| 11(ab){2}x |
11ababx |
|