Regex constraints

Hello,

I am trying to set up a constraint that requires a user to enter a 3-
digit integer within the range 001-999. This is the expression I've
used:

.

However, 0 does not seem to register as an integer, so it will not
allow me to enter a number between 001 and 099, but will allow 100 to
999.

Can anyone please help me solve this issue?

Many thanks.
Glyn

However, 0 does not seem to register as an integer, so it will not
allow me to enter a number between 001 and 099, but will allow 100 to
999.

How about /^(00[1-9]|[1-9]\d{2}|\d[1-9]\d)$/

Then you don't need the gt/lt stuff.

··· > > Can anyone please help me solve this issue? > > Many thanks. > Glyn > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

...But you should be storing this as a string and using a text data
type. Otherwise the leading 0's will be truncated.

··· On 23 August 2011 09:44, Thomas Smyth wrote: >> However, 0 does not seem to register as an integer, so it will not >> allow me to enter a number between 001 and 099, but will allow 100 to >> 999. > > How about /^(00[1-9]|[1-9]\d{2}|\d[1-9]\d)$/ > > Then you don't need the gt/lt stuff. > >> >> Can anyone please help me solve this issue? >> >> Many thanks. >> Glyn >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en >> >

Thanks Thomas.
Glyn

··· On Aug 23, 6:45 pm, Thomas Smyth wrote: > ...But you should be storing this as a string and using a text data > type. Otherwise the leading 0's will be truncated. > > On 23 August 2011 09:44, Thomas Smyth wrote: > > > > > > > > >> However, 0 does not seem to register as an integer, so it will not > >> allow me to enter a number between 001 and 099, but will allow 100 to > >> 999. > > > How about /^(00[1-9]|[1-9]\d{2}|\d[1-9]\d)$/ > > > Then you don't need the gt/lt stuff. > > >> Can anyone please help me solve this issue? > > >> Many thanks. > >> Glyn > > >> -- > >> Post: opendatakit@googlegroups.com > >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> Options:http://groups.google.com/group/opendatakit?hl=en