fix usage of Regex.test method