View Single Post
Old 08-11-2009, 01:20 PM   #1 (permalink)
Enfernikus
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default Date parsing issue

I have this issue where I MUST use JavaScript to parse all dates on the page and reformat them, now I figured using the match method and replace the found results with the reformatted dates would be fine but it stands that my Regex is failing or I'm implementing the method incorrectly.


javascript Code:
var Matches = document.body.innerHTML.match(/\d{4}(\-)\d{2}(\-)\d{2}/);
alert(Matches); //Null
 

Anyone wants to have a looksie and see if possibly I'm just missing the glaringly obvious?

EDIT: Well than...Don't I feel stupid, I was missing the global search 'g' flag...I'll leave this here for anyone's future needs
__________________
My Blog
Enfernikus is offline  
Reply With Quote