Community Patterns

Community Library Entry

0

Regular Expression
Created·2022-09-30 16:42
Flavor·PCRE2 (PHP)

/
(?:[A-Z]\.)+|[A-Z][a-z]+
/
gm
Open regex in editor

Description

works with strings such as: U.K.TanzaniaU.S.A., UkraineFrance, GermanyU.S.A.

Issues:

  1. Doesn't work with repeating acronyms, e.g.: U.K.U.S.A.; possible fix: (?:[A-Z].){1,3}|[A-Z][a-z]+
  2. Works only with country's acronyms that have the same number of dots as the number of capital letters
Submitted by whatserface