Regular Expressions 101

Sponsors

Community Patterns

Community Library Entry

4

Regular Expression
Created·2020-07-01 10:38
Flavor·PCRE (Legacy)

/
[^ -AEIOU[-ÿ]
/
g
Open regex in editor

Description

With regex you can count the number of matches. Can you make it return the number of uppercase consonants (B,C,D,F,..,X,Y,Z) in a given string? E.g.: it should return 3 with the text ABcDeFO!. Note: Only ASCII. We consider Y to be a consonant! Example: the regex /./g will return 3 when run against the string abc.

Submitted by anonymous