xsl-list
[Top] [All Lists]

[xsl] regular expressions in XSLT 2.0

2011-08-28 16:14:34
Hello,

I have a question about regular expressions in XSLT 2.0. I noticed that

test="matches('40e','^\d{1,3}|[ivxl]{1,7}$')"

will be evaluated as true, which puzzles me, since I thought it should be evaluated as false. (A regular expressions test page I found on the internet (http://www.fileformat.info/tool/regex.htm) indeed evaluates the test as false.)

When I add parentheses in the regular expression, i.e.,

test="matches('40e','^(\d{1,3}|[ivxl]{1,7})$')"

the test comes out false, however.

So my question is this: Why does the test without the parentheses come out true? That is, how is the regular expression interpreted by the xslt engine such that "40e" is considered a match? And why to the parentheses make a difference? (I thought the parentheses would be redundant in this case.) Or is this maybe an issue specific to the xslt engine I use (Saxon9he)?

Thanks in advance for your help!
Wolfhart

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>