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
8.31Mb 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

Before and Afterlives by Christopher Barzak
False Impressions by Thayer, Terri
The Governess Club: Louisa by Ellie Macdonald
White Blood by Holder, Angela
Gool by Maurice Gee
Tsea by Arthurs, Nia