you only need parentheses when there's a capture
Are they not also needed where there is optionality?
Could this be (sensibly) rewritten without the parenthesis?
To substitute hiss/hisses for leak but not substitute hisse or hisss.$example =~ s/hiss(es)?/leak/;
In reply to Re^3: regex in REPLACEMENT in s///
by Bod
in thread regex in REPLACEMENT in s///
by perlboy_emeritus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |