in reply to Regex Problem - alternative searched

Hi, I looked at the posts in the link you provided. one of the scenarios looks like exponential explosion when using alternations improperly (metioned in OReilly's book "Mastering Regular Exprssions" by J. Friedl). One of the solutions might be "unfolding" the alternations by using the following pattern:
<!--[^-]*(?:-[^-]+)*-->
which is supposed to be faster than your previous one.

Regards,
Xicheng

Replies are listed 'Best First'.
Re^2: Regex Problem - alternative searched
by Skeeve (Parson) on May 18, 2007 at 15:52 UTC

    That's it! Great! Thanks! It works!

    I guess you mentioned a book I should at least a look at.


    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e