Question

I need a regular expression that will pick out lines with ALL CAPS or unknown acronyms.

ie: something like

/[A-Z]{2,}/ 

combined with

/(?!USA|UK|TLA)/
Was it helpful?

Solution

You mean something like this?

\b(?!(?:USA|UK|TLA)\b)[A-Z]{2,}\b

See it here on Rubular

\b is a word boundary to ensure that it will find complete words.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top