Subject: Re: [xsl] Special characters in regex expression From: "mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 23 Jul 2014 19:55:19 -0000 |
Exclamation mark is not a special character in XPath regular expressions, and there does not need to be (and must not be) escaped. Negative lookaheads are not supported in the XPath regular expression dialect. You can't assume that all regular expression dialects are the same. Michael Kay Saxonica > Dear All, > > I am using xsl:analyze-string to retrieve and replace punctuation, > however, I got the following error: > > Error in regular expression: net.sf.saxon.trans.XPathException: Syntax > error at char 6 in regular expression: Escape character '!' not allowed. > > How should I escape and match '?' and '!' ? I am also using a negative > look-ahead, why isn't that working? > > Here is a sample from my code, thanks, > > Gabor > > > <xsl:template match="//TEI:p//text()[ not > ((parent::TEI:note)|(parent::TEI:hi)|(parent::TEI:date))]"> > <xsl:analyze-string select="." regex="(\.|\!|\?)(?!\)|\.|\d|\w)"> > > <xsl:matching-substring> > > <xsl:element name="seg" > namespace="http://www.tei-c.org/ns/1.0"><xsl:value-of > select="."/></xsl:element> > </xsl:matching-substring> > <xsl:non-matching-substring> > <xsl:value-of select="."/> > </xsl:non-matching-substring> > </xsl:analyze-string>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Special characters in regex e, Gabor Toth bewindoki | Thread | Re: [xsl] Special characters in reg, Michael Dykman mdykm |
[xsl] Special characters in regex e, Gabor Toth bewindoki | Date | Re: [xsl] Special characters in reg, Michael Dykman mdykm |
Month |