[xsl] Is there a way in XSLT/XPath to find the portion of a string that matches a pattern?

Subject: [xsl] Is there a way in XSLT/XPath to find the portion of a string that matches a pattern?
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Mar 2025 22:01:34 -0000
Hi Folks,

The following XPath determines if the string in $TEXT contains a vowel:

matches($TEXT, 'A|E|I|O|U')

If there is a match-the string in $TEXT contains a vowel-then which vowel was
matched? A? E? I? O? or U? It may be desirable to know that.

Another example: an XSLT program wants to know the series of digits in a
string; if the string is, "The person put 12 dollars into the jar" and the
pattern is [0-9]+ then the matched portion is "12".

Problem Statement: if the value of $TEXT is a string and the value of $REGEX
is a pattern, then is there a way in XSLT/XPath to find the portion of the
string that matches the pattern?

/Roger

Current Thread