Validation rule for Numbers and Special Characters in Salesforce

If your field Should contain number and (',',';', and '/') special characters alone, use the below validation rule

Validation Rule:

NOT(
        REGEX( SLASerialNumber__c , "[0-9,;/]*")
        )


Cheers!!!

5 comments:

  1. I am getting erro when i have used like this

    NOT(REGEX(License_User_SSO_IDs__c ,"[0-9,]{9}*"))

    when i remove the *, also it is not validating properly.

    ReplyDelete
  2. Try this

    NOT(REGEX(SIC ,"[0-9,]{9}"))

    Cheers!!!

    ReplyDelete
  3. Hi I need hypen to be added:but the below code doent accept the hypen-.Not working.
    NOT(
    REGEX( SLASerialNumber__c , "[0-9,;/-]*")
    )

    ReplyDelete
    Replies
    1. try this

      NOT(
      REGEX(InfallibleTech__Area__c , "[0-9,;,/,-]*")
      )

      Cheers!

      Delete
  4. NOT(
    OR(
    ISBLANK( Contract_ID__c ),
    ISNUMBER( Contract_ID__c , "[0-9]")
    )
    )

    This not working. Field can either be blank or numbers

    ReplyDelete