The s modifier might help you.
$ perl -le ' > $str = qq{Keyword string\nBlah\nKeyword\nstring\nBlech\nKeyword "str +ing"}; > print $str; > print; > $str =~ s{Keyword(\s+"?)string}{Keyword${1}1_string}sg; > print $str;' Keyword string Blah Keyword string Blech Keyword "string" Keyword 1_string Blah Keyword 1_string Blech Keyword "1_string" $
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: Help with multiple line regex subsitution
by johngg
in thread Help with multiple line regex subsitution
by gator456
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |