Subhash Rawat
Subhash Rawat

Reputation: 922

Find 2 or more consecutive Capital letter in a string

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

Upvotes: 1

Views: 1256

Answers (1)

Subhash Rawat
Subhash Rawat

Reputation: 922

The correct regex :-

([A-Z]{2,})

Upvotes: 3

Related Questions