[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Ungready Flag on Regex

Subject: Ungready Flag on Regex
From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Oct 2020 14:22:57 -0000
 Ungready Flag on Regex
Hello !

I have a regex that tries to detect bold parts in a markdown string.

In markdown, bold parts are delimited with ****. For example :

    Not bold but **this one is blod** text.

Here, *"this one is bold"* should be dispayed as bold text.

For this, I use this regex :

    <xsl:analyze-string select="$s" regex="\*\*[^*]*\*\*">

Now, I have a string that contains comments markers, and these markers 
should be displayed in bold :

    Comments are delimited by **/* */** or prefixed by **//**

*/* */* should be in bold, *//* should be in bold, but *"or prefixed 
by"* should not be in bold.

My regex can't do that. But with PCRE (PHP) regex, I can use flag "U" 
(ungready, that make quantifiers lazy), and with this flag, I get 
exactly what I expect.

Is there an equivalent of Ungready tag, or a syntax that let me get what 
I want ?

Best regards,

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.