Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (38 sloc) 1.33 KB

#Salesforce.com Regular Expression Validation Improve data integrity and consistency by using regular expression validation rules.

To do:

  • Social security number
  • Tax Identification Number
  • Street Address
  • Driver's License
  • Credit Card Number
  • Credit Card Expiration Date
  • Credit Card Security Code CVS
  • Currency
  • IP Address
  • Date

##Account Billing Zip/Postal Code (USA) Validates an account's billing zip/postal code is in 5 digit format or 9 digit format if the billing country is USA.

(BillingCountry=="USA")
&&
NOT(REGEX(BillingPostalCode, "\\d{5}(-\\d{4})?"))

##Contact Mailing Zip/Postal Code (USA) Validates a contact's mailing zip/postal code is in 5 digit format or 9 digit format if the mailing country is USA.

(MailingCountry=="USA")
&&
NOT(REGEX(MailingPostalCode, "\\d{5}(-\\d{4})?"))

##Username Only allow usernames that contain alphanumeric characters (letters A-Z, numbers 0-9) with the exception of underscores. This helps to make sure usernames do not contain any symbols, dashes, or spaces. The following example is unobtrusive and relies on either the field definition or page layout to make the field required.

  • Field type: text
  • Minimum length: 1
  • Character limit: 15
  • Letters
  • Numbers
  • Case insensitive
NOT(REGEX(Username__c, "([a-zA-Z0-9_]{1,15})?"))