use RegExp.test instead of String.match for pattern testing