Changed matchesRegex validation method to use RegExp.test instead of RegExp.exec