Regex match a date

Hi,


var str = 'date-2010-06-08';
var re = /(\\d{4})-(\\d{2})-(\\d{2})/;
var found = str.match(re);
alert(found[0]);

Is there a better way ?

Thanks in advance.

Bye.


var str = 'date-2010-06-08';
var re = /(\\d{4})-(\\d{2})-(\\d{2})/g;
var found = str.match(re);
alert(found);