What I want to do is str.replace(pattern, callback)
,
not simply str.replace(pattern, replace_pattern)
,
is it possible to do it in javascript?
Why, yes, you can do exactly that: str.replace(pattern, function () { ... })
.
Here's some documentation: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/replace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With