Regex newbie here, I'm trying to create a validation rule which will restrict users from entering a number or a special characters to a certain field.

This is what I have so far:

!IsNew() && REGEX(Origin__c, '[!@#$%^&*(),.?":{}|<>0-9]')

However, it does not work as I'm still able to insert inputs such as: 'abc123' or 'abc@df'

I checked the regex expression in regextester.com and it worked, it detected what I needed, but in SF it didn't, so what am I missing?


You could try something like this.

!IsNew() && NOT(REGEX(Origin__c, "^[a-z A-Z]*$"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.