I have this regular expression
([A-Z], )*
which should match something like
test, (with a space after the comma)
How to I change the regex expression so that if there are any characters after the space then it doesn’t match.
For example if I had:
test, test
I’m looking to do something similar to
([A-Z], ~[A-Z])*
Cheers
Use the following regular expression:
Explanation:
^matches the start of the string.[A-Za-z]*matches 0 or more letters (case-insensitive) — replace*with+to require 1 or more letters.,matches a comma followed by a space.$matches the end of the string, so if there’s anything after the comma and space then the match will fail.As has been mentioned, you should specify which language you’re using when you ask a Regex question, since there are many different varieties that have their own idiosyncrasies.