Validation rule for blank space or white space in Salesforce

Validation rule for blank space or white space in Salesforce

\\s is used in Validation rule for blank space or white space in Salesforce.

Sample Validation Rule:

AND( 
 NOT(ISBLANK(Test__c)), 
 AND(NOT(REGEX(Test__c, '\\d{14}')), 
  NOT(REGEX(Test__c, '\\d{3}\\s{1}\\d{3}\\s{1}\\d{3}\\s{1}\\d{5}')) 
 ) 
)

This will support only the following
12345678912345
or
123 456 789 12345

Leave a Reply