I was trying to remove the “[“or “]” pattern present in a string.
var str = "abc<1<2<>3>4>def";
while (str != (str = str.replace(/<[^<>]*>/g, "")));
using the above code which is removing “<” “<>” “>” pattern when i try to replace this with my operators it does’nt work .
any ways can any one provide me any regex or small one liner to replace all the operator present.
For ex a= [1[2]3][4
should be after removing 1234
or
a =1[2]3]
should be after removing 123
Your while condition is not required here as the regex will remove all instances of
[and]it finds due to thegglobal parameter.