XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (123 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
2.39Mb size Format: txt, pdf, ePub

The most useful properties that may be specified in the
\p
and
\P
constructs are described below; for a full list see Chapter 14.

Property
Meaning
L
All letters.
Lu
Uppercase letters, for example, A, B, Š, Σ.
Ll
Lowercase letters, for example, a, b, ñ, λ.
N
All numbers.
P
Punctuation (full stop, comma, semicolon, and so on).
Z
Separators (for example, space, newline, no-breaking space, en space, em space).
S
Symbols (for example, currency symbols, mathematical symbols, dingbats, and musical symbols).

Captured Groups

Within the

element, it is possible to refer to the substring that matched the regular expression as
.
, because it is provided as the context item. Sometimes, however, it is useful to be able to determine the strings that matched particular parts of the regular expression.

Any subexpression of the regular expression that is enclosed in parentheses causes the string that it matches to be available as a
captured group
. For example, if the regex
([0-9]+)([A-Z]+)([0-9]+)
is used to match the string
13DEC1987
, then the three captured groups will be
13
,
DEC
, and
1987
. If the regular expression were written instead as
([0-9]+)([A-Z]+([0-9]+))
, then the three captured groups would be
13
,
DEC1987

Other books

The Goblin's Gift by Conrad Mason
Texas Hold Him by Lisa Cooke
Strangclyf Secret by McCall, Mary
The Ascendant Stars by Cobley, Michael
The King's Justice by Stephen R. Donaldson
Boy O'Boy by Brian Doyle
Tiny Island Summer by Rachelle Paige
Season for Scandal by Theresa Romain