+ Start a Discussion

REGEX Validation Rule

I need help writing a REGEX Validation rule.



                  Filed Name - TestNo

                  Field length  - 23 characters

                   No of values in the field - 4 values with 5 characters (only numbers) seperated by commas.

                  Eg: 12345,23456,12356,23456


I need a validation rule that makes sure the TestNo(s) are 5 digits and separated by commas with no spaces


Can someone help me in building a formula using REGEX or some other function.

Try this
NOT( OR( LEN (TestNo) = 0, REGEX(TestNo, "[0-9]{5},[0-9]{5},[0-9]{5},[0-9]{5}") ) )

Hi imutsav,


I tried out your VR. It is still not working.


We have a similar VR setup for an other field, but this field has alphanumberic values and has 4 characters in each value separated by commas.


IF(ISBLANK(Facets_Grp_Num__c), FALSE,
NOT(REGEX(Facets_Grp_Num__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}")))


Anyway I can change this and used it for my condition strictly numeric with 5 characters in each value?

Felipe Justino Linhares 3Felipe Justino Linhares 3
    NOT(LEN (TestNo) = 23)