Reputation: 1771
I have a string Pigs __(cant)__ fly.
I want to replace the word __( )__
with an input field. What is the regex for this? I can do very simple regex stuff but this is going up above my head.
Upvotes: 0
Views: 33
Reputation: 1441
Try this:
var str = "Pigs __(2cansf33't)__ fly"
var convertedString = str.replace(/\s__\(([a-z0-9']*)\)__\s/, ' ');
console.log(convertedString)
Let me know if this helps.
Upvotes: 1