$RegexLiteral =~ s{ ( # Match something that can be quantified . . . (?: \\[\\abCdDefnrsStwWX] # \n, \w, etc. | \\c. # \cA | \\x[\da-fA-F]{1,2} # \xFF | \\x\{[\da-fA-F]*\} # \x{1234} | \\[pP]\{[^{}]+\} # \p{Letter} | \[\]?[^]]+\] # "poor man's" class | \\\W # \* | \( $LevelN \) # (...) | [^()*+?\\] # almost anything else ) # . . . and is quantified . . . (?: [*+?] | \{\d+(?:,\d*)?\} ) ) \+ # . . . and has an extra '+' after the quantifier. }{(?>$1)}gx; ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl