cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Number validation: Cannot start or end with zero

Jump to solution

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. 

Labels: (2)
0 Kudos
Reply
11 Replies
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

You can use a regular expression for validation:

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

Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

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.

0 Kudos
Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

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

Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

When I enter that expression my form crashes:

Here is my screen

0 Kudos
Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

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

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

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

Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

Ah Ha!  Thx. Will clean up.

Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

That was it! Thanks

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

Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

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.

Reply
Workflow Hero

Re: Number validation: Cannot start or end with zero

Jump to solution

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

0 Kudos
Reply