Skip to content

Commit

Permalink
fix(validators): regex validator (#1154)
Browse files Browse the repository at this point in the history
fixes #699
  • Loading branch information
nurdism committed Mar 12, 2023
1 parent f730c24 commit ed89533
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/validators/src/raw/core.js
Expand Up @@ -48,6 +48,9 @@ export const len = (value) => {
export function regex (...expr) {
return (value) => {
value = unwrap(value)
return !req(value) || expr.every((reg) => reg.test(value))
return !req(value) || expr.every((reg) => {
reg.lastIndex = 0
return reg.test(value)
})
}
}

0 comments on commit ed89533

Please sign in to comment.