top of page

Regex for lines that do not begin with X

You can run a regular expression search in a text file for any lines that do NOT begin with a particular string. In this example, we want to find any lines that do not begin with the string 'ins'. Structure your search this way:


^(?:(?!ins).)*$



The exclamation point looks for lines that do not begin with the string which follows.


The caret marks the beginning of a string.


This part: (?: indicates that the Regex search should not capture what follows.




Comments


bottom of page