Hi All,
I have below test cases as input:
[This is my test] [This is my test] My name is xyz.
Want Expected output as :
[This is my test] My name is xyz.
.[This is my test] My name is xyz.
Want Expected output as:
My name is xyz.
For above test cases I want to replace only first occurrence of '[This is my test] ' with blank. I don't want to replace second occurrence of match.
How do I resolve this using regex in JavaScript?
Thanks in advance.
ETA:
I just want to give more clarification that, i dont want to use hard coded value in regex , i want to use variable in regex.
Assume that [This is my test]
is stored in one variable i.e. var defaultMsg = "[This is my test] ";