From 4fdebafc3aaa1468bc8a52fa3e891c485a93ade0 Mon Sep 17 00:00:00 2001 From: Federico Ciardi Date: Wed, 25 May 2022 23:20:26 +0200 Subject: [PATCH] fix(matches): prevent regex state from breaking following validations --- src/lib/matches.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/matches.js b/src/lib/matches.js index 5b435e2af..9e23c2e46 100644 --- a/src/lib/matches.js +++ b/src/lib/matches.js @@ -5,5 +5,5 @@ export default function matches(str, pattern, modifiers) { if (Object.prototype.toString.call(pattern) !== '[object RegExp]') { pattern = new RegExp(pattern, modifiers); } - return pattern.test(str); + return !!str.match(pattern); }