fix pyflakes validation and remove unnecessary brackets in regex