in reply to Re^4: Non-greedy substitution
in thread Non-greedy substitution

Since this is a recurring question, what helped the most? :)

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^6: Non-greedy substitution
by Bod (Parson) on Dec 04, 2024 at 19:47 UTC
    Since this is a recurring question, what helped the most? :)

    This bit was the lightbulb 💡

    the regex-engine tries to find a solution step by step:

    • first it tries the first pattern, here "," = comma
    • then it matches "." = all as many times like quantified ( "*" or "*?" )