|
-
Mar 3rd, 2004, 08:46 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Javascript/RegEx : \d{2,4}
I'm using this code to validate a date
Code:
if ( testStr.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/) == null )
{
sMessage += 'Date is not in format DD/MM/YYYY';
document.getElementById('startdate').focus();
}
Now, I have a limited understanding of Regular Expressions but doesn't \d{2,4} mean that it matches either 2 or 4 numeric characters? Because it seems to be accepting 3 numeric characters too.
Last edited by TomGibbons; Mar 3rd, 2004 at 12:05 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|