Reputation: 2858
Given the following string:
Lorem {{ipsum}} dolor {{sit}} amet
I'm trying to extract thw words ipsum and sit 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!
Upvotes: 0
Views: 45
Reputation: 324610
You have WAY too many backslashes, you're only looking for a single word character, and you're only looking for matches right at the beginning of the string.
var regexp = /\{\{(\w+)\}\}/g;
Upvotes: 2