I have a load of strings like this:
.ls-resourceIcon .icon_xls_gif, .ls-resourceIcon .icon_xlt_gif, .ls-resourceIcon .icon_xlw_gif
I want to get the strings between icon_ and _gif into a comma separated list, so in this case "xls,xlt,xlw," (I can trim the trailing comma).
I have so far got this:
var regex = new RegExp("^.*icon_(.*)_gif.*$", "g");
var result = input.replace(regex, "$1,");
but that gives me
xlw,
as a result, not all the matches.
What am I missing? Is there an easier way to do this that I haven't noticed?