tags:

views:

31

answers:

1

Hi,

I would like to do a global replace on a string like this:

var d = "{\"AlertDate\": \"\/Date(1277334000000+0100)\/\",\"Progress\": 1,\"ReviewPeriod\": 12}";

and replace all the \/Date(1234656000000+0100)\/ fields with the following:

"{\"AlertDate\": \"new Date(1234656000000+0100)",\"Progress\": 1,\"ReviewPeriod\": 12}";

How could I do this with a regular expression?

Thanks

Paul

A: 
d.replace(/\/(Date\(\d{13}\+\d{4}\))\//, "New $1");
nil