Multiline regex search in NetNeans

Recently I needed to remove some old fashioned forms on an old fashioned project – static website with like 200 pages. Each form had a name attribute with value “form1” and varying contents spread throughout multiple lines. The idea was to use NetBeans Project’s Replace feature with “Regular Expressions” checked, to do it quickly like that:

<form name="form1">.*</form>

But it didn’t work. After a short research (still quicker then hand edit these 200 files) it became clear that “dot all” regex piece doesn’t include line breaks. The addition of “(?s)” part that indicates line feeds made it work for me, here’s the final line:

<form name="form1">(?s).*</form>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.