Results 1 to 5 of 5

Thread: [RESOLVED] Javascript/RegEx : \d{2,4}

Threaded View

  1. #1

    Thread Starter
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345

    [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
  •  



Click Here to Expand Forum to Full Width