theniteowl
Programmer
I have to test a year value to have 1 or 2 digits.
I was using \d{2}|\d{1}
The problem is the value comes in with two spaces at the end filling it in as a 4 character field.
All I need is a regular expression that says 1 or 2 digits followed by any or no non-digit characters.
I am actually doing this in a proprietary scripting language of an application I have to work in, not in Javascript so I cannot do other formatting, trimming, casting, etc of the value and need to do it in the regular expression.
Anyone?
At my age I still learn something new every day, but I forget two others.
I was using \d{2}|\d{1}
The problem is the value comes in with two spaces at the end filling it in as a 4 character field.
All I need is a regular expression that says 1 or 2 digits followed by any or no non-digit characters.
I am actually doing this in a proprietary scripting language of an application I have to work in, not in Javascript so I cannot do other formatting, trimming, casting, etc of the value and need to do it in the regular expression.
Anyone?
At my age I still learn something new every day, but I forget two others.