ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:
It works great but I want to also catch everything on the same line of XYZ. For example:/bin/cat $1 | perl -00 -pe 's/ABC(.*?)XYZ/\[DATA\]\n/s'
It will become:123 ABC 123 abc XYZ hi la
But with my regex it will be:123 [DATA] la
How can I catch also 'hi'?123 [DATA] hi la
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replacing between patterns
by haukex (Archbishop) on Oct 28, 2019 at 13:05 UTC | |
by ovedpo15 (Pilgrim) on Oct 28, 2019 at 13:12 UTC | |
by haukex (Archbishop) on Oct 28, 2019 at 13:15 UTC | |
|
Re: Replacing between patterns
by jwkrahn (Abbot) on Oct 28, 2019 at 20:34 UTC | |
by rsFalse (Chaplain) on Oct 29, 2019 at 13:25 UTC |