regex - Changing date strings with jQuery and Regexp -
what kind of code should use jquery looks every yyyy-mm-dd formatted (plain text) string on page , replaces dd-mm-yyyy?
thanks lot!
that might work:
$(document.body).contents().each(function(i,e) { $(e).text(function(i,text) { return text.replace(/(\d+)-(\d+)-(\d+)/g, function($full, $year, $month, $day) { return [$day, $month, $year].join('-'); }); }); });
example: http://www.jsfiddle.net/jm2uq/
Comments
Post a Comment