Matches2tests

Optimized the code by replacing regex match() with test()