in reply to Re: substituting capture groups substrings (?...)
in thread substituting capture groups substrings
Hi tye,
Can you please explain why you would useovers/(?<=[0-9]{2})(?=[0-9]{2})/ /g
s/([0-9]{2})([0-9]{2})/$1 $2/g
I know that juxtaposing a look-behind and a look-ahead effectively matches a zero-width point between characters, for which you can then subsitute, as you did with a space. But is there a reason other than coolness to use that construct rather than the more familiar "match/capture/use captures in replacement" construct? Do you do so to avoid the overhead of populating and reading the capture variables?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: substituting capture groups substrings (?...)
by Athanasius (Archbishop) on Jul 14, 2015 at 15:22 UTC | |
|
Re^3: substituting capture groups substrings (?...)
by AnomalousMonk (Archbishop) on Jul 14, 2015 at 18:00 UTC |