The code:
var csMasterPrefix = 'CS_',
cpMasterPrefix = 'CP_',
csContentPrefix = 'CSContent_',
cpContentPrefix = 'CPContent_';
$this.attr("id")
.replace(csMasterPrefix,'')
.replace(cpMasterPrefix,'')
.replace(csContentPrefix,'')
.replace(cpContentPrefix,'')
.replace('ibtn','')
.replace('btn','')
.replace('lbtn','')
.replace('img','')
.toLowerCase();
Question: Let me introduce the preface by saying that I looked at the solutions that say to make your own βpureβ function. My question really is not how to do this, but how can I make an ONE regex that combines all replacement calls into one?
source
share