replaced brace matching with a regex