Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable regex output to be string or function #214

Closed
SaltatorMortis opened this issue Jun 23, 2017 · 3 comments
Closed

enable regex output to be string or function #214

SaltatorMortis opened this issue Jun 23, 2017 · 3 comments

Comments

@SaltatorMortis
Copy link

SaltatorMortis commented Jun 23, 2017

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();});
@0styx0
Copy link

0styx0 commented Jun 29, 2023

@Woundorf mind if I make a PR to address this usecase, addding the ability replace using JS functions?

@Woundorf
Copy link
Owner

Woundorf commented Jul 5, 2023

@0styx0 If you can make a PR for this it will be very welcome. But you should include some scary warning about not pasting code from untrusted sources, otherwise a Mozilla reviewer could block its download. See for reference the warning in the URL field in the options page.

Woundorf added a commit that referenced this issue Aug 23, 2023
…tion

#214 feature/implement replace js function
@Woundorf
Copy link
Owner

Implemented by pull request #351 by @0styx0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants