0

I'm cleaning some code and I want to locate all the strings composed of 3 capitalized letters, so I used this regex in the search engine of Visual Studio :

\"[A-Z]{3}\"

However a lot of "GET" show up in the results and make it difficult to see the pertinent results.

As I don't want to touch the "GET", is there a regex to match all the 3 letters strings, but not "GET" ?

  • `\"(?!GET)[A-Z]{3}\"` – Avinash Raj Nov 06 '17 at 13:49
  • As usual, you use the left context pattern, then add the negative lookahead with the unwanted word with a right-hand boundary, and then use the rest of your "general" pattern. If your regex engine supports lookbehinds, it can be done with the lookbehind, too. See the attached thread. – Wiktor Stribiżew Nov 06 '17 at 13:51

0 Answers0