Checking for two characters, if there is only one remove it
===

What would be the best way to check if a string contains two different characters and if it doesn't contain both of them it will remove them, for example:

[hello]
[hello

I would want the second one to simply remove the bracket if it is there without it's partner bracket.