Posted on

RED – how to match lines that don’t contain a character

Time for another Regular Expression of the Day! Let’s say you are looking for all of the lines that don’t have a special character (like an ‘_’ underscore). Here is it:


Start of line, followed by characters that are NOT underscore, followed by End of line

It’s a little confusing that the start of line indicator is a carrot so if you think of it instead as the NOT the end of line indicator it helps