foxreplace icon indicating copy to clipboard operation
foxreplace copied to clipboard

enable regex output to be string or function

Open SaltatorMortis opened this issue 7 years ago • 0 comments

regex nativly supports the feature to use a string or a function it would be cool if we could use this inside foxreplace

a simple sample:

var re = /(\b[a-z](?!\s))/g;
var s = "this is a sample text to camelcase this text!"; 
s1 = s.replace(re, function(x){return x.toUpperCase();});
//or if multiple capture groups something like this
s2 = s.replace(re, function(...x){x.string=x.pop(); x.index=x.pop(); return x[1].toUpperCase();});

SaltatorMortis avatar Jun 23 '17 05:06 SaltatorMortis