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

Author: sirspot

I write software, love my wife and kids, do various house projects, play video games when I have time, and could use a little more sleep