You need to sign in to do that
Don't have an account?
Validation rule: Only accepted characters
Hello everyone,
At the moment, I'm trying to implement a validation rule that would check to see that certain characters are used/not used.
The description is basically: Available Charactersare: 0-9 a-z A-Z. , - / & [blank space]
I figure I would need to use REGEX for this, but I'm not completely familiar with REGEX, so after doing some reading and research I came up with this:
REGEX ( Business_Owner_First_Name__c , "[a-zA-Z0-9 // /, /& - / ] {50}")
Now I know I probably have a number of things wrong with this logic and the testing seems to suggest that.
If any REGEX experts might be able to help, I'd be very appreciative.
You can use this formula if you want to stop in case any of the charater exists
This will return true if any of the specified charater is used in the text
If you want to allow in case of any of the character user this
All Answers
You can use this formula if you want to stop in case any of the charater exists
This will return true if any of the specified charater is used in the text
If you want to allow in case of any of the character user this
Thanks. That did the trick.
Your welcome
One last thing - that particular formula doesn't seem to work for blank spaces like ' '. Is there a way to tell it to include those?
It is working for me can you provide what formula you have used. Out of two that I provided.
The code I'm using is:
not(REGEX( Business_Owner_First_Name__c , "^[a-zA-Z0-9-/]*$"))
Why don't you use
Yes this does not check space with REGEX but will workfine for your case as we have separately checked that.
That helps, though i had to do some tweaking to make it considering both ' ' and invalid characters. If invalid characters are there, but with an blank space, then it'll pass the validation rule. Changing the or to and fixes this.
However, now I need to check for multiple fields with the same logic. Below is the validation code I have for it. I feel like I'm just one step away from making this work.
not(
and(
and(CONTAINS(Business_Owner_First_Name__c, ' '), REGEX( Business_Owner_First_Name__c , "^[a-zA-Z0-9-/]*$")),
and(CONTAINS(Business_Owner_Last_Name__c, ' '), REGEX( Business_Owner_Last_Name__c , "^[a-zA-Z0-9-/]*$")),
and(CONTAINS( Applicant_s_First_Name__c, ' '), REGEX( Applicant_s_First_Name__c , "^[a-zA-Z0-9-/]*$")),
and(CONTAINS( Applicant_s_Last_Name__c, ' '), REGEX( Applicant_s_Last_Name__c , "^[a-zA-Z0-9-/]*$")),
and(CONTAINS(Card_Report_First_Name__c, ' '), REGEX( Card_Report_First_Name__c , "^[a-zA-Z0-9-/]*$")),
and(CONTAINS(Card_Report_Last_Name_Suffix__c, ' '), REGEX( Card_Report_Last_Name_Suffix__c , "^[a-zA-Z0-9-/]*$"))))
Not sure it will work for you or not, but its working for me :
Just added a space in regex.
Thanks
Ankit Arora
Blog | Facebook | Blog Page