You need to sign in to do that
Don't have an account?

Regex
Hi,
Is there a way to use REGEX to check a field to make sure it follows a specifi format with a delimiter?
The field will have alfa-numeric values but they must be 4 digits long with a comma seperation and no spaces. There is no specific on how many groups of these alfa-numerics are allowed.
These would be valid:
1xi4,GX19,Nn92
ZZZ1,8939,YXKE,791W
These would not be valid:
1x49d,GX1,Nn92
,1xi4,GX19,Nn92
1xi4,GX19,Nn92,
1xi4,GX19, Nn92
I had the comma in the wrong spot!
It should be inside the lef pareth:
NOT(REGEX(Facets_Grp_s__c, "[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9](,[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]){0,10}"))
If anyone has a shorter version I would life to have it. I tried the \W but Salesforce didn't like it!
All Answers
I started this but it doesn't seem to completely work as I described in my prior post above! :(
NOT(REGEX(Facets_Grp_s__c, "[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9],([a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]){0,10}"))
If I put in 039H,393Y I can save
if I put in 039h, 393Y I cannot save
Those are good and working as expected
However, ....
if I put in nothing I cannot save (I need to save the record if the field is blank)
If I put in 039H I cannot save ( should be able to save with only one entry)
Please help!
I had the comma in the wrong spot!
It should be inside the lef pareth:
NOT(REGEX(Facets_Grp_s__c, "[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9](,[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]){0,10}"))
If anyone has a shorter version I would life to have it. I tried the \W but Salesforce didn't like it!