Regular Expressions 101

Enterprise
Sponsor⁠s

Community Library

Community Library Entry

0

Regular ExpressionOpen Workspace

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

Description
Created·2022-09-30 16:42
Type·Match
Flavor·PCRE2 (PHP)

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
Open Workspace