You need to sign in to do that
Don't have an account?

validation rule to exclude special characters except (.) and (‘).
Hi Everyone,
I want to have a validation rule to prevent special characters in text field except these 2: (.) and (‘). please advise. thanks
I want to have a validation rule to prevent special characters in text field except these 2: (.) and (‘). please advise. thanks
Cyrus T
www.levementum.com
NOT(REGEX( test__c ,"{.}{'}"))
and I received this error when I tried to save it:
Error: java.util.regex.PatternSyntaxException: Illegal repetition {.}{'}
https://regex101.com/
Im not sure if you want substrings containing . or ' or multiple occurrences
not(REGEX( Company , "[a-zA-Z0-9\\.\\']+"))
I guess that works too. this is what I used and is working well.( almost same as yours)
NOT( REGEX( test__c , "[a-zA-Z0-9.']+"))
Thanks for your reply
AND(
(NOT (ISBLANK(BillingStreet ))),
(NOT(REGEX(BillingStreet , "^[^<>&\"\']*$")))
)
(1) You need to escape single and double quotes with a proceeding backslash (eg \" or \') so that salesforce understands you're trying to use the literal values
(2) you need a ^ symbol before and after your start bracket ...this wouldn't necessarily be the case if using the regular expression anywhere other than SFDC
(3) you need *$ after your end bracket ...this also wouldn't necessarily be the case if using the regular expression anywhere other than SFDC
...2 and 3 above imply "starts with" and "ends with" but SFDC evaluates this to "contains". So, this validation rule catches 123 Main St Suite A&B ...as intended... but allows 123 Main St Suite A and B ...also as intended.
Name = Opportunity Name
NOT(REGEX(Name , "^[^<:>*?|.&\"\']*$"))