This is a chunk of Google Apps Script code:
var re = /(<.*?>)+/;
var strip = str.replace(re, "");
Logger.log(strip);
Why does it strip only the first instance of tag?
This is a chunk of Google Apps Script code:
var re = /(<.*?>)+/;
var strip = str.replace(re, "");
Logger.log(strip);
Why does it strip only the first instance of tag?
var re = /(<.*?>)/g
The trailing g
is a flag you need to set to replace all matching instances. Depending on the content of str
you are passing Another flag you may wish to try adding is m
which signifies that the pattern should apply to multiple lines i.e.
var re = /(<.*?>)/mg