There is a field for 6 digit serial number in a record. Since the field can contain only numbers, I have created a validation rule with regex to check only numbers are entered in the text field. But then the users needed the functionality to enter multiple serial numbers separated by semi-colon in a record. I've changed the VR to check for numbers and semi-colons.

 NOT(REGEX( Serial_Number__c ,  '^[0-6;]*$'))

But in addition, I'm trying change the VR to make sure that the user is entering only single or multiple 6 digit numbers separated by semi-colons. For example, 123456;234567;345678 and not 123;123456;45;5678

But it is not working.

 NOT(REGEX( Serial_Number__c ,  '^[0-6;]+\\d6*$'))

It is checking if there are only numbers and semi-colons but not if only six digit numbers are separated by semi-colons. Where is the mistake? Any help would be appreciated.

  • I'm voting to close this question as off-topic because it is really about building RegEx patterns.
    – Mark Pond
    Feb 23, 2015 at 21:13
  • Oh @Mark, I'm sorry. Do I have to remove this question and post it other community?
    – Seesh
    Feb 23, 2015 at 21:18
  • This is a bit generic but then it is in a formula field and I think somewhere like StackOverflow would close this because it's not code, so let's keep it open :)
    – Matt Lacey
    Feb 24, 2015 at 3:08
  • @LaceySnr Oh yea. True. :)
    – Seesh
    Feb 24, 2015 at 17:45

1 Answer 1


Try this RegEx [0-9]{6}(;[0-9]{6})*


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .