Home > OS >  Find and replace multiple special characters in Notepad but exclude blank lines
Find and replace multiple special characters in Notepad but exclude blank lines

Time:10-22

I have a lot of data that I'm trying to ensure is formatted correctly.

So I'm trying to build a RegEx search in Notepad that finds any line that does NOT begin with any of the following:

  • L =
  • L[
  • Country

My RegEx serach should also NOT find lines that are blank (either completely blank or blank lines containing spaces and/or tabs).

Example data:

L = 56
Country: Russia
Square
L["Moscow"]
    
L = 43
Round
Country: America
L["Boston"]

The blank line in the example data (the line below Moscow) is a blank line comprised of spaces and tabs.

So from my example data, I want my RegEx search to result in the following finds:

Square
Round

My RegEx search should not find lines that start with L =, Country, L[ and it should not find blank lines (either completely blank or blank lines comprised of spaces and tabs). So all that it should find is Square and Round.

How can I do this?

CodePudding user response:

Try this regex

^(?!L =|L\[|Country|\s*$)

It actually excludes the L =, L[ , Country and also unwanted spaces

Tell me if its not working...

  • Related