multiline perl search and replace (one-liner)
- by yaya3
I want to perform the following vim substitution as a one-liner in the terminal with perl. I would prefer to allow for any occurences of white space and/or new lines, rather than explicitly catering for them as I am below.
%s/blockDontForget">\n*\s*<p><span><a\(.*\)<\/span>/blockDontForget"><p><a\1/g
I've tried this:
perl -pi -e 's/blockDontForget"><p><span><a(.*)<\/span>/blockDontForget"><p><a$1/msg'
I presume I am misinterpreting the flags. Where am I going wrong? Thanks.
EDIT:
The above example is to strip the spans out of the following html:
<div class="block blockDontForget">
<p><span><a href="../../../foo/bar/x/x.html">Lorem Ipsum</a></span></p>
</div>