Home > OS >  Find 2 or more consecutive Capital letter in a string
Find 2 or more consecutive Capital letter in a string

Time:05-08

While working with java code linting and formatting I was getting error to remove all consecutive capital letters in variables, classs, function name. So to find all those words in source code this regex worked.

Example:-

 - testSTring  ---> match
 - testString  ---> no match
 - TEstString  ---> match
 - teststrING  ---> match

CodePudding user response:

The correct regex :-

([A-Z]{2,})
  • Related