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

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

Subexpressions can be nested. They are numbered according to the position of the opening parenthesis, counting from the left. For example, when the string
12 September 2008
is matched by the regex
([0-9]+)\s(([A-Z])([a-z]+))\s([0-9]*)
, group 2 will be
September
, group 3 will be
S
, and group 4 will be
eptember
.

In the
replace()
function, groups can be referenced within the replacement string using a character sequence such as
$1
or
$2
. For example, the result of
replace(‘12 September 2008’, ‘([0-9]+)\s([A-Za-z]+)\s([0-9]+)’, ‘$2$1, $3’)
will be
September 12, 2008
.

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

Other books

Tis the Season to Be Sinful by Adrienne Basso
Sleeper by Jo Walton
The Dark Lord's Demise by John White, Dale Larsen, Sandy Larsen
Impossible Magic by Boyd, Abigail
Whisper Falls by Elizabeth Langston
Eyes of the Cat by Riser, Mimi
Detective by Arthur Hailey