Bug: whitespace at beginning of regex fails the regex when in 'x' (ignore whitespace) mode

View: New views
2 Messages — Rating Filter:   Alert me  

Bug: whitespace at beginning of regex fails the regex when in 'x' (ignore whitespace) mode

by Abel Braaksma (online) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

Using xsl:analyze-string and applying the flag 'x', whitespace in a
regular expression should be ignored, with the exception of whitespace
in character classes. The following XSLT template prints "NOT FOUND" only.

    <xsl:template match="/">
        <xsl:analyze-string select=" 'abc' " regex=" a" flags="x">
            <xsl:matching-substring>FOUND</xsl:matching-substring>
            <xsl:non-matching-substring>NOT
FOUND</xsl:non-matching-substring>
        </xsl:analyze-string>
    </xsl:template>


I believe this is in error. Whitespace inside the regular expression and
whitespace at the end of the expression is correctly ignored by the parser.

Cheers,
-- Abel Braaksma
   http://www.nuntia.nl

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
saxon-help mailing list
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help

Re: Bug: whitespace at beginning of regex fails the regex when in 'x' (ignore whitespace) mode

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, now fixed in Subversion.

This affects the JDK1.5 regex translator only (not JDK1.4 or .NET)

Michael Kay

> -----Original Message-----
> From: saxon-help-bounces@...
> [mailto:saxon-help-bounces@...] On Behalf
> Of Abel Braaksma
> Sent: 22 December 2006 11:29
> To: Mailing list for SAXON XSLT queries
> Subject: [saxon] Bug: whitespace at beginning of regex fails
> the regex when in 'x' (ignore whitespace) mode
>
> Hi all,
>
> Using xsl:analyze-string and applying the flag 'x',
> whitespace in a regular expression should be ignored, with
> the exception of whitespace in character classes. The
> following XSLT template prints "NOT FOUND" only.
>
>     <xsl:template match="/">
>         <xsl:analyze-string select=" 'abc' " regex=" a" flags="x">
>             <xsl:matching-substring>FOUND</xsl:matching-substring>
>             <xsl:non-matching-substring>NOT
> FOUND</xsl:non-matching-substring>
>         </xsl:analyze-string>
>     </xsl:template>
>
>
> I believe this is in error. Whitespace inside the regular
> expression and
> whitespace at the end of the expression is correctly ignored
> by the parser.
>
> Cheers,
> -- Abel Braaksma
>    http://www.nuntia.nl
>
> --------------------------------------------------------------
> -----------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the
> chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge
> &CID=DEVDEV
> _______________________________________________
> saxon-help mailing list
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
saxon-help mailing list
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help