Return to Snippet

Revision: 61011
at November 22, 2012 15:12 by inreflection7


Initial Code
// Bad example but you get where I'm going with this.

my_string = "{{some_var}} weather out today";

my_string.replace(/\{\{(.+?)\}\}/g, 'great');

Initial URL


Initial Description
For those moments of weakness when .replace() looks like a good idea...

Initial Title
Safe replace {{some_var}} in JS strings

Initial Tags
js, template

Initial Language
JavaScript