Match d-M-Y with javascript regex how?
Posted
by bakerjr
on Stack Overflow
See other posts from Stack Overflow
or by bakerjr
Published on 2010-05-25T02:48:24Z
Indexed on
2010/05/25
2:51 UTC
Read the original article
Hit count: 368
JavaScript
|regex
Hi, my date formatting in PHP is d-M-Y and I'm trying to match the dates with a javascript regex:
s.match(new RegExp(/^(\d{1,2})(\-)(\w{3})(\-)(\d{4})$/))
To be used with the jQuery plugin, tablesorter. The problem is it's not working and I'm wondering why not.
I tried removing the dashes in my date() formatting (d M Y) and tried the ff and it worked:
s.match(new RegExp(/^\d{1,2}[ ]\w{3}[ ]\d{4}$/));
My question is what is the correct regex if I'm using dashes on PHP's date() i.e. d-M-Y? Thanks!
© Stack Overflow or respective owner