Support multiple contexts by improving the regular expressions and the parsing function.