Cleanup scanner.py

We have removed the test_scan function, the test_cases list, and
refactored out the regex into global regex.