Complex(?) regex: Is expression, but not another
- by Kieron
(If you can make a better title, please do)
Hi,
I need to make sure a string matches the following regex:
^[0-9a-zA-Z]{1}[0-9a-zA-Z\.\-_]*$
(Starts with a letter or number, then any number of letters, numbers, dots, dashes or underscores)
But given that, I need to make sure it doesn't match a Guid, my Guid matching reg-ex looks like this (obviously, this needs to be negated in the merged result):
^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$
The last requirement here is that they must (if it's possible) be merged into a single expression.