I have a string like asdasd 18.06.2013 07:57
the following code return the date and time (18.06.2013 07:57) well, but i hope there is more clean solution to do this
report_t=$('#reportResult h2:nth(0)').text().match(/[\d]+/g);
$('#output').val(function(){
return report_t[0]+"."+report_t[1]+"."+report_t[2]+" "+report_t[3]+":"+report_t[4];
}
There is a clean solution to do that!?
UPDATE I found a solution:
/[0-9].+/g
and Jack has one too. Thak You!
/\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}/g
Just move the matching inside the expression:
/\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}/g
Then, each match will contain the whole date/time block.
> 'asdasd 18.06.2013 07:57'.match(/\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}/g)
["18.06.2013 07:57"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With