in reply to Re: Using Look-ahead and Look-behind
in thread Using Look-ahead and Look-behind
You're reading your input line-by-line but you're trying to match across lines. That won't work.
The following should work, reading the input all at once (see perlrun):
perl -g -i -pe ’s/(?<=look)\n(?=ahead)/-/g;’ myfile.txt
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Using Look-ahead and Look-behind
by akiemr19 (Initiate) on Nov 28, 2024 at 13:24 UTC | |
by hippo (Archbishop) on Nov 28, 2024 at 14:06 UTC |