in reply to Re^2: regex in REPLACEMENT in s///
in thread regex in REPLACEMENT in s///
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/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: regex in REPLACEMENT in s///
by haukex (Archbishop) on Sep 13, 2023 at 06:37 UTC | |
by Bod (Parson) on Sep 13, 2023 at 10:42 UTC |