You need to sign in to do that
Don't have an account?
Jeff Talbot
Where is the documentation for REGEX?
Where can I find the documentation on building the "regex_text" part of the REGEX function? All I can find in Help/Training/Release Notes is a few examples of a working formula. There is nothing that explains the different characters and codes that can be used in the "regex_text" part of this function.
Syntax:
REGEX(text, regex_text)
REGEX(text, regex_text)
Instructions:
Replace text with the text field, and regex_text with the regular expression you want to match
Replace text with the text field, and regex_text with the regular expression you want to match
Examples:
REGEX(Drivers_License__c, "([A-Z]\\d{7})?")
REGEX(BillingPostalCode, "\\d{5}(-\\d{4})?")
REGEX(Credit_Card_Number__c, "(((\\d{4}-){3}\\d{4})|\\d{16})?")
REGEX(IP_Address__c, "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" )
REGEX(Social_Security_Number__c, "[0-9]{3}-[0-9]{2}-[0-9]{4}")
REGEX(Drivers_License__c, "([A-Z]\\d{7})?")
REGEX(BillingPostalCode, "\\d{5}(-\\d{4})?")
REGEX(Credit_Card_Number__c, "(((\\d{4}-){3}\\d{4})|\\d{16})?")
REGEX(IP_Address__c, "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" )
REGEX(Social_Security_Number__c, "[0-9]{3}-[0-9]{2}-[0-9]{4}")
http://www.regular-expressions.info/
http://regexlib.com/
Also, O'Reilly has a great book called "Mastering Regular Expressions".
When using external examples with our REGEX formula function, the key thing to keep in mind is that the backslash characters (\) must be changed to double backslashes (\\) because backslash is an escape character in Salesforce.
Anyone else have any favorite sources for regex wisdom?
Cheers,
Eric Bezar
force.com Platform Product Management
All Answers
"Regular expression syntax is based on Java Platform SE 6 syntax. However, backslash characters (\) must be changed to double backslashes (\\) because backslash is an escape character in Salesforce."
Hope this helps! Regular expressions are very powerful and will make your formulas shorter and more efficient!
http://www.regular-expressions.info/
http://regexlib.com/
Also, O'Reilly has a great book called "Mastering Regular Expressions".
When using external examples with our REGEX formula function, the key thing to keep in mind is that the backslash characters (\) must be changed to double backslashes (\\) because backslash is an escape character in Salesforce.
Anyone else have any favorite sources for regex wisdom?
Cheers,
Eric Bezar
force.com Platform Product Management
Definitely look at the regex examples in the salesforce online help, too. I've found that the best way to learn is to study examples.
And I will bet dollars to donuts that if you post a specific regex question on this board, someone in the community will help you out.
Good luck,
Eric
YOU ARE THE MAN! ("When using external examples with our REGEX formula function, the key thing to keep in mind is that the backslash characters (\) must be changed to double backslashes (\\) because backslash is an escape character in Salesforce.")
You just save me hours of work! Good Job! Thanks!
AcMEGX
I seem to be having a real bear of a time getting this to work for a Flow validation on a text field. All I want to do is have it evaluate a text field in a flow screen to ensure that it doesn't contain special characters that would cause a MS Filename to puke.
Any ideas?
AND(
OR(Country = "CAN", Country = "CA", Country = "Canada"),
NOT(REGEX(PostalCode,
"((?i)[ABCEGHJKLMNPRSTVXY]\\d[A-Z]?\\s?\\d[A-Z]\\d)?"))
)
Here is the PDF link
http://resources.docs.salesforce.com/200/6/en-us/sfdc/pdf/salesforce_useful_validation_formulas.pdf
Regular Expressions are an extremely useful tool for finding information throughout any text by searching with one or more matches of your specific search pattern, such as a sequence of characters from unicode.Regex code (https://brandwitty.com) for example: ([^” “]*\s){5,}? to get the length.