You need to sign in to do that
Don't have an account?
Swetha S415
validation rule to prevent special characters and all zeros in a text field
Hi Developers,
Need a help to achieve below functionality.
how to write a validation rule such that it should not allow any special characters(!@#$%^&*) and not allow all zeros in a field. (eg: 0 or 00 or 000 or 0000).
I have used the below validation rule that is restricting special characters but allowing all zeros.
NOT(REGEX(Phone__c,"^[a-zA-Z0-9]*$"))
Need a help to achieve below functionality.
how to write a validation rule such that it should not allow any special characters(!@#$%^&*) and not allow all zeros in a field. (eg: 0 or 00 or 000 or 0000).
I have used the below validation rule that is restricting special characters but allowing all zeros.
NOT(REGEX(Phone__c,"^[a-zA-Z0-9]*$"))
Correction to the previous reply.
OR(NOT(REGEX(test__c,"^[a-zA-Z0-9]*$")),REGEX(test__c,"^[0]*$"))
All Answers
Greetings to you.
Please use below syntax:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.
Thanks and Regards,
Khan Anas
Hi Swetha,
This will work.
OR(NOT(REGEX(test__c,"^[a-zA-Z0-9]*$")),REGEX(test__c,"^[0-9]*$"))
Kindly select it as the best answer if it works.
Thanks
Hope you are doing good!
The phone field should accept zeros but should not accept all zeros.
Accceptable: 90807543
Not Acceptable: 000000
Regards,
Swetha
Hi Yash,
Thank you for your valuable reply. But the validation is firing if it contains at least one zero.
The validation should not fire if it contains zero it should fire if it contains all zeros.
Regards,
Swetha
Correction to the previous reply.
OR(NOT(REGEX(test__c,"^[a-zA-Z0-9]*$")),REGEX(test__c,"^[0]*$"))
Thank you, Yash!
It worked.
Regards,
Swetha