javascript - Regex - is there something I've done wrong? -


this javascript, virtually identical regex failing in php too, don't think it's language specific

var r = new regexp(     "^(:19|20)?[0-9][0-9]"            // optional 19/20 start followed 2 numbers     + "-"                             // hyphen     + "(:0?[1-9]|1[0-2])"             // optional 0 followed 1-9, or 10, 11, 12     + "-"                             // hyphen     + "(:3[01]|[12][0-9]|0?[1-9])$"   // idea. ); r.test("2008-07-01");                // == false 

what on earth missing?

i think non-capturing blocks should e.g. (?:19|20) rather (:19|20)


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -