[xsl] invalid escape sequence: \b

Subject: [xsl] invalid escape sequence: \b
From: "Tony Zanella" <tony.zanella@xxxxxxxxx>
Date: Mon, 29 Sep 2008 15:49:14 -0400
Hello all,
I'm using oXygen 9.3 to write a template that uses a regular
expression as an argument for the xslt function matches().  While
writing the regex, I used oXygen's onboard find/replace with the
option for regular expression selected to test for what I wanted. I
managed to get the following regex working on some test data:

[IVXMDC]\b

For example, given the following three lines:

VI
Pt. XXIV
Chapter II. CHARITABLE EFFORT
II: England

The regex matches on all and only the roman numerals when I just use
oXygen's find/replace.

But when I try to plug this into an xsl instruction:

<xsl:if test="not(matches(.,'[IVXMDC]\b'))">
         <xsl:value-of select="lower-case(.)"/>
      </xsl:if>

I get the following error:

Description: Error at character 10 in regular expression
"[IVXMDC]+\b": invalid escape sequence

...and running the template breaks things. Searching the forums, I
found this thread:

http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200801/msg00304.html

from which I gathered that I might try to remove the backslash and see
if the transformation worked. But doing that didn't work. Nor did
escaping the backslash with another backslash.

Thanks in advance for any tips. And sorry if this isn't the right
forum for this post.
Tony

Current Thread