I have the following information:
a). a String in this format [name(label)] bla [name2(label2)] bla [name3(bla3)]
b). Strings name and name2
I need to replace [name(label)] and [name2(label2)] (anything can be between round brackets) with another string (say *), so the result needs to be * bla * bla [name3(bla3)]
Input
[name(label)] bla [name2(label2)] bla [name3(bla3)]
name and name2
Output
* bla * bla [name3(bla3)]
How can I do that using regex in Java?
 
     
     
    