Advise with RegEx validation in SP13 Nintex Form


Hey

 

Would somebody help with my RegEx validation, please.
I am using Nintex Form in SharePoint 2013 and this is my current RegEx:

 

^[A-Z]{4}[.][0-9]{4}[.][0-9]{8}[.][0-9]{3}

this validates the input only if it's like: PAGB.1234.12345678.123
Due to some changes, I also need to validate this PAGB.12345.12.123

Am I right to believe that this would achieve the above requirement:

 

^[A-Z]{4}[.][0-9]{4|5}[.][0-9]{2|8}[.][0-9]{3}

Thank you!!

 


2 replies

Here are some online resources you can use to troubleshoot RegEx:
https://www.regextester.com/
https://regex101.com/
Userlevel 2
Badge +4

Hi James,


 


Give this a shot:


 


^[A-Z]{4}[.]d{4,5}[.]d{2,8}[.]d{3}

 


The error was because of the {4|5}. It didn't evaluate as 4 or 5 characters. Use {4,5} instead. You can also use d in lieu of [0-9].


 


Let me know if this helps!

Reply