1 month ago

JS - Reg ex new value in str replace

Posted 1 month ago by JeroenvanRensen

Hi everyone,

I have got a problem with Regular Expressions. I do have this string:

And I want to change it to this:

But, nl and Republikeinwever can change, and it should still work.

So this:

Should become this:

How can I do this in pure JS?

I tried to do it with Regular Expressions, but couldn't solve it.

Something like this?

var newValue = oldValue.replace(

I hope anyone can help me.


Please sign in or create an account to participate in this conversation.