Reputation: 3931
I am looking for a regular expression matching specific single characters or specific combination of them like:
BCDFGHJKLPQRSTVWXZ for the singles
PR FR TR GR CR PH CH for the doubles
How can I put this in a regular expression ? Thanks.
Upvotes: 0
Views: 44
Reputation: 67988
[BCDFGHJKLPQRSTVWXZ]
for singles
(?:\bPR\b|\bFR\b|\bTR\b|\bGR\b|\bCR\b|\bPH\b|\bCH\b)
for the doubles
You can do this using character class
and alternation
operator or OR
operator.
EDIT:For both in single expression.
[BCDFGHJKLPQRSTVWXZ]|(?:\bPR\b|\bFR\b|\bTR\b|\bGR\b|\bCR\b|\bPH\b|\bCH\b)
Upvotes: 2