Skip to main content

Regular expression match

XML
<match var="var" var_matches="var" pattern="regexp" offset="int">
string
</match>

<match /> performs a global regular expression match on a subject against a given pattern and assignes the number of full matches to 'var', while the actual matches are assigned to 'var_matches'.

Results are ordered so that matches[0] is an array of first set of matches, matches[1] is an array of second set of matches, and so on.

If the offset is negative it will start that many characters from the end of the subject.

Attributes

NameTypeDescriptionDefined By
varvarResult variable name for number of matches match
var_matchesvarResult variable name for actual matches match
patternregexpPattern match
offsetintSearch offset match

Results

BindingTypePredicate
varintN/A
var_matchesarrayno-result-propagation

Examples

XML
<match var="count" var_matches="matches" pattern="/ixml/i">My name is iXML!</match>

<if value1="$count" func="&gt;" value2="0">
<output>$matches[0][0]</output>
</if>

<!-- iXML -->