Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:07:48+00:00 2026-06-17T16:07:48+00:00

I have following regex which I found from this website: Bt somewhere the syntax

  • 0

I have following regex which I found from this website:

Bt somewhere the syntax is incorrect and it throws error:

var myDate = /^(0?[1-9]|1[0-2])\/(0?[1-9]|[12][0-9]|3[01])\/(19|20)[0-9]{2};

Just to be clear:

Date can be anything between 01/01/1900 and 31/12/2099 but format should be strictly:

DD/MM/YYYY

I know there are several solutions on web, all similat but somehow it is throwing javascript error.

Probably syntax mistake because just above that i have put email validation which works fine:

var email = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:07:49+00:00Added an answer on June 17, 2026 at 4:07 pm

    The message from the console says

    SyntaxError: unterminated regular expression literal

    you’re missing a / at the end of the line, so it should be

    var myDate = /^(0?[1-9]|1[0-2])\/(0?[1-9]|[12][0-9]|3[01])\/(19|20)[0-9]{2}/;
    

    As pointed out in the comments, you may also have intended to put a $ at the end before the /. This indicates to regex that you should match the end of the string (see your email example later in the OP).

    As an aside; validating the general format of a date using regex is valid and worthwhile. Trying to validate it’s an actual real, valid (ie, not 30 feb 2012) date using regex is barmy. The regex to be able to do it properly would be pages upon pages long!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is weird, I have the following std::regex (rx) \{\{alternate form of\s*\|(?:\d=)?(.*?)([\|#][^\|}]*)*\}\} which regex_search
I have the following regex which validates dates: //are not both dates if (!methods._isDate(first[0].value)
I might have pretty basic question about regex. I have the following regex, which
I have written the following regex to match a set of e-mails from HTML
I have looked here and from what I understand the following regex simply means
I have the following data: abc def; ghi. This regex will match: ([a-z0-9A-ZÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ ]*)\W
I have the following regex ^[a-zA-Z0-9]+$ which would allow alpha numeric characters. The problem
I'm using the followin RegEx which I found in this similar question : /[^\s"]+|"[^"]*"/g
I have the following regex: /[0-9#%@_$&!?^\/|*<>]+/i which is not supposed to accept letters. It
i have the following regex: private string tokenRegEx = @\[%RC:(\w+)%\].*?; which is when i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.