How can I detect with a regular expression if the same consonant is repeated three or more times?
My idea is to match words like tttool
, likkke
, or likkkkke
Try this:
([b-df-hj-np-tv-z])\1{2,}
Explanation:
[b-df-hj-np-tv-z]
are all the consonants\1
is the back reference to the 1st group (ie the same character){2,}
means "2 or more of the preceding term", making 3 or more in all See live demo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With