Remove useless g flag from Regex
Use regex .test instead of .match for consistency and performance