Regular Expressions 101

Community Patterns

Match everything before first vowel for pig latin conversion

1

Regular Expression
PCRE (PHP <7.3)

/
\b([^a,e,i,o,u]{0,}qu|[^a,e,i,o,u]+)([a,e,i,o,u][a-z]+)?
/
gi

Description

matches all the consonants (including qu as a consonant, since for these purposes it is) up to the first vowel and splits it on that

Submitted by Todd Nestor - 8 years ago