Saturday, 14 September 2013

Javascript match regex against group

Javascript match regex against group

Given the following string:
Lorem {{ipsum}} dolor {{sit}} amet
I'm trying to extract thw words ipsum and amet with the following regex:
content = 'Lorem {{ipsum}} dolor {{sit}} amet'
var regexp = /^\\\{\\\{(\w)\\\}\\\}/g;
var match = regexp .exec(content);
The match object returns null. What am I missing? Thanks!

No comments:

Post a Comment