Michael Zeidler wrote:
regexp:match('123abc567','([0-9]+)([a-z]+)([0-9]+)') gibt kein Arry mit den gematchten Gruppen zurück: Wenn ich also mit <xsl:variable name="test" select="regexp:match('123abc567','([0-9]+)([a-z]+)([0-9]+)')"/> die variable $test setzte, müsste ich mit $test[0], $test[1], usw. auf die gematchten gruppen zugreifen können. Siehe http://www.exslt.org/regexp/functions/match/index.html
[translation]:
regexp:match('123abc567','([0-9]+)([a-z]+)([0-9]+)')
does not return an array containing the matched groups. Something like this <xsl:variable name="test" select="regexp:match('123abc567','([0-9]+)([a-z]+)([0-9]+)')"/> should allow me to ask for "$test[0]" etc.
Hmm, interesting. The page doesn't actually say that this is supposed to work. All they provide is an example with a /single/ group. The result of your test case is not defined. For comparison, I now implemented the examples from the page as unit tests, which sadly showed that Python's regexps are incompatible with what EXSLT requires. The Python RE "([a-z])+ " does not match "test " as in EXSLT, only the last "t" is returned for the group by re.findall(). So we can't claim compatibility with EXSLT at this point. -- Note, though, that I never really said it was compatible, it just builds on Python's re module. I still think that's enough for a Python XML library. That said, I fixed your use case in the current trunk, as I think it makes sense to expect the result above from such a call. Note, however, that EXSLT dictates that the first element in a non-global RE result (without 'g' flag) must be the entire string that matched, which even fits the semantics of the group() method in Python's MatchObjects. So your $test[0] will contain "123abc567", $test[1] is "123" etc. Stefan