Jamie Kudla
Jamie Kudla

Reputation: 872

regex to match what is not matched

I have a regex to search through just under 2 million product numbers: -([A-Za-z0-9]{1-5})$ to match the MFG code (last few letters after the last dash) for example, G4F,XB-RJG4 SJG2G-TRMH would match -TRMH. This was supposed to match every string on my list, however, I am a couple thousand short. This probably means that some were formatted wrong.

what could I do to match a string that doesn't end in -XXXXX, -XXXX, -XXX, or -XX, or in other words, match what is not matched?

Upvotes: 0

Views: 60

Answers (1)

Ja͢ck
Ja͢ck

Reputation: 173662

Just two steps:

  1. In the search dialog, tick "Bookmark line"
  2. After the search is done, click "Search -> Bookmark -> Inverse Bookmark"

Alternatively, in step 2: "Search -> Bookmark -> Remove bookmarked lines"; afterwards, only the lines that didn't match the regular expression remain.

Upvotes: 1

Related Questions