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

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

Branches and Pieces

The top-level syntax of a regular expression (regex) is described by the following rules:

Construct
Syntax
regex
branch (
|
branch )*
branch
piece*
piece
atom quantifier?

A regular expression consists of one or more
branches
, separated by
|
characters. For example,
abc|def
matches either of the strings
abc
or
def
. A regex matches a string if any of the branches matches the string. If more than one branch leads to a match, then the one that is chosen is the first one that matches (starting from the left).

A
branch
consists of one or more
pieces
, concatenated together. A branch consisting of two pieces A and B matches a string if the string can be split into two substrings, with the first substring matching A and the second matching B. For example,
def
is the concatenation of three pieces,
d
,
e
, and
f
, and it matches a string consisting of a
d
followed by an
e
followed by an
f
. The regex
[a-z][0-9]

Other books

A Question of Marriage by Temari James
The Absolutely True Story of Us by Melanie Marchande
A Great Deliverance by Elizabeth George
Seize the Night: New Tales of Vampiric Terror by Kelley Armstrong, John Ajvide Lindqvist, Laird Barron, Gary A. Braunbeck, Dana Cameron, Dan Chaon, Lynda Barry, Charlaine Harris, Brian Keene, Sherrilyn Kenyon, Michael Koryta, John Langan, Tim Lebbon, Seanan McGuire, Joe McKinney, Leigh Perry, Robert Shearman, Scott Smith, Lucy A. Snyder, David Wellington, Rio Youers
Manly Wade Wellman - Novel 1940 by Twice In Time (v1.1)
America's Secret Aristocracy by Birmingham, Stephen;
The Kissing Diary by Judith Caseley
Coal Black Blues by Lee Ann Sontheimer Murphy
Yvonne Goes to York by M. C. Beaton
Leap of Faith by Danielle Steel