Removed need for regex, better "[" and "]" substitution.