[RESOLVED] Validate empty string in regular expression
Hello,
I have a string field where the user only can enter NULL or the nummeric value 1-199
I know
^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-9][0-9]|4[0-9][0-9]|5[0-9][0-9]|6[0-9][0-9]|7[0-9][0-9]|8[0-9][0-9]|9[0-9][0-9])$
Checks for the value 0 to 199 but not null.
How can I change the formula so When Null or 1 to 199 is entered results in a match?
Re: Validate empty string in regular expression
^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-9][0-9]|4[0-9][0-9]|5[0-9][0-9]|6[0-9][0-9]|7[0-9][0-9]|8[0-9][0-9]|9[0-9][0-9])?$
Re: Validate empty string in regular expression
That's it..
Thank you very much!!!!!
Re: [RESOLVED] Validate empty string in regular expression
One small question?
What when I want to match for empty spaces?
Re: [RESOLVED] Validate empty string in regular expression
\s is the regex symbol for white space (space, v-tab... etc) You can check out regex lib for samples and details