This is a simplified description of MyTextString.txt:
Note: BlaBla stands for any character including new line character.
START BlaBla-In END BlaBla-Out-Between START BlaBla-In END BlaBla-Out-Between START BlaBla-In END BlaBla-Out-Between START BlaBla-In END ...
I'm looking for removing text between END and START (BlaBla-Out-Between) to result like this:
START BlaBla-In END newline START BlaBla-In END newline START BlaBla-In END newline START BlaBla-In END ...
I've a perl file changes.pl:
BEGIN {
@ARGV = map glob(""$_""), @ARGV;
}
s/(END).*?(START)/$1
$2/sg; #TEST
I should execute my replaces using this CMD line:
perl -i.bak -p changes.pl My/File/Directory/MyTextString.txt
Note: the changes.pl and CMD line are working well as described in this question with other RegEx find and replace strings.
But with this RegEx string no modifications happen to MyTextString.txt:
s/(END).*?(START)/$1
$2/sg;
I think every thing regarding my regular expression syntax is OK as it's working well on regex 101 tester.
I'm looking for matching and replacing any character (including newline) using mentioned changes.pl and CMD line. Simply, I'm looking for replacing BlaBla-Out-Between with newline.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…