0

I am working on a validation rule (potentially looking into other methods later) that will prevent users from putting a credit card number or social security number in a text field. The issue i am running into is the user may end up typing a sentence before either of these numbers since its typically a notes field.

I started with the SSN check and the

REGEX( Manager_Notes__c , "((\\d{3}-\\d{2}-\\d{4})|\\d{9})?") 

works however if in this text field a user typesHi im a SSN 000-00-0000 then this validation rule does not fire. I'm looking for a way to validate if a SSN or a CC number is anywhere in a string of text so even if both are present the rule will fire.

2

Can you try this one and see if it works in your scenario?

REGEX(Manager_Notes__c , ".*\\b\\d{3}-?\\d{2}-?\\d{4}|\\d{9}\\b.*")

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.