in reply to one line regular expression - help needed
Hello and welcome!
I think your "problem" is that <ADDRESS> and </ADDRESS> are on different lines, and -n goes through your file line by line.
Conveniently, Perl can work with line-oriented stuff quite well:
perl -i.bak -ne "print unless /<ADDRESS>/ .. m!</ADDRESS>!"
This approach only works if there is only one <ADDRESS> sequence and you want to remove that.
Your regular expression does not seem to allow for (much) whitespace between <ADDRESS> and the email address starting. If you change the following dot to \s*, you will have more success in matching. You still need to slurp the whole input at once. I think -0777 will activate slurp mode.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: one line regular expression - help needed
by morgon (Priest) on Jul 29, 2010 at 18:03 UTC | |
|
Re^2: one line regular expression - help needed
by Thalamus (Acolyte) on Jul 29, 2010 at 08:46 UTC |