I would like to match lines that have the phrase a test
but not start with >
. So I want to match
This is a test
a test this is
but not
> This is a test
I am not sure how to do this without lookahead in emacs.
As a first try I tried^[^>].*a test
. However, for some reason, this matches > This is a test
when there's a newline before it which I don't understand since the first character in a line should not be >
.
What is the correct regular expression for this case? And why is my regular expression matching lines starting with >
.