0

I was wondering if it was possible to get a regular expression which excludes certain words but is also inclusive of extentions of that word and at the same time not care about the case (so it wouldnt matter what case the word is in, the same principal would apply).

Say, I currently have a field with the following Regex validation: ^([a-zA-Z0-9 -]{2,30} but I want to limit this so the words "car" and "carrot" are disallowed (this applys for both capitals and lower case). All other values would be allowed such as "cars", "carpet" and "carrots". I basically only want to disallow the value if it is only "car" and "carrot" and I suppose if there is white space it should also be disallowed " car", "car " etc should also be disallowed.

Is this possible at all with regex?

Any help greatly appreciated.

Thanks.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
J145
  • 607
  • 1
  • 11
  • 16

0 Answers0