[xsl] Ungready Flag on Regex

Subject: [xsl] Ungready Flag on Regex
From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Oct 2020 14:22:57 -0000
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="\*\*[^*]*\*\*">
    ...
    </xsl:analyze-string>

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,
Christophe

Current Thread