The regular expression in if statement does works as using "[[]]" instead of "[]", so I made it work this way.