I want to have a Regex that will not return the strings that are enclosed in html comments starts in <!--
and/or ends in -->
I currently only have this to check if it is starting in <!--
and has a text equal to hello
:
^(?!<!--).*hello.*$
It seems to work fine but when I test my examples that are multiline, it doesn't return any match at all.
Here is what I test it with:
hello there
<!- hello there -->
<!-- hello there -->
So I expect that the first two would be returned as matches:
hello there
<!- hello there -->
But this Regex test returns no result, unless I only have the first line (hello there
) given:
regexr.com/5t1ng
Help anyone?? And how to have a Regex check to exclude in matches if ending in -->
?
That is, I expect that:
<!-- hello
- shouldn't matchhello -->
- shouldn't match<-- hello -->
- shouldn't match<!- hello
- should match<-- hello
- should match<-- hello ->
should match
Thanks!