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

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

Within the

instruction, the contents of matched groups of characters can be referenced using the
regex-group()
function, described on page 860 in Chapter 13.

Back-References

A back-reference can be used to refer to a captured group from within the regular expression itself. A back-reference is written as a backslash followed by a positive number. Back-references are often used to match opening and closing quotes; for example, the regex
([’”]).*\1
matches the strings
“Hello”
and
‘Hello’
but not
“Hello’
.

A single digit following a
\
is always recognized as part of the back-reference; subsequent digits are recognized as part of the back-reference only if there are sufficiently many parenthesized subexpressions earlier in the regex. For example,
\15
is recognized as a back-reference only if there are at least 15 parenthesized subexpressions preceding it in the regular expression; if this is not the case, then it is interpreted as a back-reference
\1
followed by the digit
5
.

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

Other books

Magic Bitter, Magic Sweet by Charlie N. Holmberg
I Made You My First by Threadgoode, Ciara
Tempted by Fate by Kate Perry
Say Ye by Celia Juliano
Wolf Winter by Cecilia Ekbäck
Panic by K.R. Griffiths
Doorways in the Sand by Roger Zelazny