68
rated 0 times
[
73]
[
5]
/ answers: 1 / hits: 16724
/ 8 Years ago, wed, july 13, 2016, 12:00:00
I would like to remove square brackets from beginning and end of a string, if they are existing.
[Just a string]
Just a string
Just a string [comment]
[Just a string [comment]]
Should result in
Just a string
Just a string
Just a string [comment]
Just a string [comment]
I tried to build an regex, but I don't get it in a correct way, as it doesn't look for the position:
string.replace(/[[]]+/g,'')
More From » regex