Activity Forums Salesforce® Discussions How to create a regular expression to validate SSN in lightning component in Salesforce?

  • Piyush

    Member
    November 18, 2019 at 4:52 am

    Hi Nikita,

    You can write a function to create a regular expression to validate SSN in lightning component:-

    For Example:-

    function validat (value){
           var  ssnPattern = /^[0-9]{3}-?[0-9]{2}-?[0-9]{4}$/;
           return ssnPattern.test(value);
       }

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos