Good way to replace multiple channels with javascript

advertisements

is there any way to do the next lines of code more elegant in javascript? Basically I am trying to replace any occurrence of {{ or }} with empty string. Here is what I use now:

tmp = "{{ some_text }}"
tmp = tmp.replace(/{{/g , "");
tmp = tmp.replace(/}}/g , "");
tmp = tmp.trim();

Thanks!


You can use OR in the regex

tmp = "{{ some_text }}";
tmp = (tmp.replace(/{{|}}/g, "")).trim();