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

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

The
piece
A{3}
matches a sequence of exactly three
A
s;
A{3,}
matches a sequence of three or more
A
s, and
A{3,5}
matches a sequence of at least three and at most five
A
s.

By default, quantifiers are greedy—they match as many occurrences of the relevant characters as they can, subject to the regex as a whole succeeding. For example, given the input string
17(c)(ii)
, the regular expression
\(.*\)$
will match the substring
(c)(ii)
. Adding a
?
after the quantifier makes it non-greedy, so the regex
\(.*?\)$
will match the substring
(c)
. This doesn't affect the
matches()
function, which is only concerned with knowing whether or not there is a match, but it does affect
replace()
and
tokenize()
, and XSLT's

, which also need to know which particular characters matched the regex.

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

Other books

Break Point: BookShots by James Patterson
The Children of Silence by Linda Stratmann
Kraken by China Mieville
Paying the Price by Julia P. Lynde
The Sixth Family by Lamothe, Lee
The Sunburnt Country by Palmer, Fiona
Twopence Coloured by Patrick Hamilton
Voice of the Heart by Barbara Taylor Bradford
Kids Is A 4-Letter Word by Stephanie Bond