I have a series of files containing html comments (<!-- some comment -->) that I'm trying to match using grep
Comments span across only 1 line.
Here is my command
grep -rl '<!--.*?-->' ./
This doesn't match. However if I run grep with this regex:
grep -rl '<!--.*?' ./
It works.
The original regex works in javascript, but grep doesn't seem to like it for some reason unknown to me.
Thanks.
The default regex engine (POSIX basic) in grep does not support ?. This works, since . will also match the space:
grep -rl '<!--.*-->' ./
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With