Regular Expressions 101

Community Patterns

Community Library Entry

-1

Regular Expression
PCRE2 (PHP >=7.3)

/
[b-df-hj-np-tv-z]
/
gm

Description

Use regex to test whether a letter is a consonant or not. Use /[B-DF-HJ-NP-TV-Z]/ for capitals.

Submitted by Matthew Hiebing - 2 years ago