minor code reduction (re.compile is not needed as we need only few regexp and python handles caching)