Skip to content

Commit

Permalink
ajuste en expresion regular
Browse files Browse the repository at this point in the history
  • Loading branch information
jlobos committed Apr 15, 2024
1 parent 2cad702 commit 9af7f2e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ function validate (rut) {
return false
}

// if it starts with 0 we return false
// so a rut like 00000000-0 will not pass
if (/^0+/.test(rut)) {
return false
}

if (!/^0*(\d{1,3}(\.?\d{3})*)-?([\dkK])$/.test(rut)) {
if (!/^([1-9]\d{0,2}(\.?\d{3})*)-?[\dkK]$/.test(rut)) {
return false
}

Expand Down

0 comments on commit 9af7f2e

Please sign in to comment.