in reply to more info about regex updates

using the question mark as a quantity qualifier following a character or expression denotes 0 or 1 of those. perl has extensions to the standard regular expressions on systems with sed/awk/grep etc. quite a few of those extensions in perl regex start with a question mark inside brackets. non-greedy matching is with *? quantifier, nothing to do with the previous construct. sometimes you have to be careful with the non-greedy match, as it can also match the zero-width nothingness before the next match, if the next match can eat up the prior characters. the \1 \2 \3 etc match replacements are part of original (unix utilities) regular expression syntax, and are being phased out in perl, in favor of $1 $2 $3 etc. this is because the legacy syntax is only maximum 9 match replacements, i.e. \1 thru \9.
all of these things are departures (extensions) to original (unix) regular expression syntax, and have been with us since perl 5.6 or 5.8. most of the extensions are typically not necessary in a lot of typical day to day work, and hence not widely known/used. it's pretty nice though to come from a unix background to learn perl, and find out that 99% of standard regex syntax applies. a good understanding of even the standard regular expression syntax is a good asset to have.
the hardest line to type correctly is: stty erase ^H