I want to use grep to search a file for all lines containing <div
, except that I do not want lines between <!--
and -->
.
I have this regex to find the lines containing <div
: ^.*\<div.*$
I have this regex to exclude the lines between <!--
and -->
: ^((?!\<!--.*?--\>).)*$
— but it doesn't work. It only matches when the comment is in a single line. How can I fix that?
How can I combine these in one grep line? Or do I have to type two greps?