Skip to main content

Is there a way to validate end user entry so that the 1st and last number upon data entry cannot be a zero? 

Here is what the department would like: 

XYZ #: 6 numbers max (done), Numbers only (Done), Cannot start or end with 0 (not done) 

The field was created in SharePoint 2013 and set at one line text, 6 char max.  In Nintex I set the validation for numbers only. 

You can use a regular expression for validation:

^([1-9]d{0,4}[1-9]|d)$

211620_pastedImage_2.png


Thank you for the reply. I am looking at this and I am sure it makes sense but I am confused as to how to apply it to my situation.


Use the following settings for single line text control in Nintex Forms:

211621_pastedImage_1.png


When I enter that expression my form crashes:

Here is my screen


You have an extra ) added after 1-9]) <----

 ^((1-9])d{0,4}}1-9]|d)$

 ^(^1-9]d{0,4}41-9]|d)$


Ah Ha!  Thx. Will clean up.


That was it! Thanks

‌ - Big thanks to you for getting this going and solved.


Sorry, please change ^([1-9]d{0,4}[1-9]|d)$ to ^([1-9]d{0,4}[1-9]|[1-9])$

This ensures that numbers with only one digit may not have the value 0.


What is a good resource to reference this syntax so I can learn and build upon it?


there are so many tutorial sites for regular expressions. See Regex Tutorial—From Regex 101 to Advanced Regex , play with online tester Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript and check Microsoft docu for .NET regular expressions.


TY


Reply