Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
The regex must not be one that matches a zero-length string. This rules out values such as
regex=“”
or
regex=“[0-9]*”
. The reason for this rule is that languages such as Perl have different ways of handling this situation, none of which are completely satisfactory, and which are sensitive to additional parameters such as
limit
, which XSLT chose not to provide.
The input string is formed by evaluating the
select
expression, and the processor then analyzes this string to find all substrings that match the regex. The substrings that match the regex are processed using the instructions within the
[0-9]+
, then any consecutive sequence of digits in the input string is passed to the
Within the
.
. It is also possible within the
Captured Groups
below.
Because the instruction changes the context item, it's often useful to bind a variable to the context node before entering the instruction, so that you can refer to it within the
Neither a matching substring nor a nonmatching substring will ever be zero-length. This means that if two matching substrings are adjacent to each other in the input string, there will be two consecutive calls on the
Omitting either the
In working its way through the input string, the processor always looks for the first match that it can find. That is, it looks first for a match starting at the first character of the input string, then for a match starting at the second character, and so on. There are several situations that can result in several candidate matches occurring at the same position (that is, starting with the same character in the input). The rules that apply are: