Menu

#279 regex syntax: \s with "x" flag

v8.2
closed
5
2012-10-08
2004-12-31
Michael Kay
No

A spurious error is reported if the construct \s is
used in a pattern when the "x" flag is set.

The reason for the error is that Saxon translates the
regular expression from XPath regex syntax into Java
regex syntax, and the construct \s is translated to "
" where the contents of the square brackets are a
space, a tab, a newline, and a carriage return. This
construct is syntactically invalid when the "x" flag
(which causes literal whitespace to be ignored) is used.

Applies to 8.2 and previous releases. Source code
fixed. Test case added: regex22.

Discussion