I'm trying to find a way to replace nth match of more matches lite this.
string = "one two three one one"
How do I target the second occurence of "one"?
Is it possible to do something like this?
string.replace(/\bone\b/gi{2}, "(one)")
to get something like this
"one two three (one) one"
I've done a jsfiddle which is working but it doesn't feel right. Heaps of code and confusing for a simple thing.