Skip to content

Commit 7415423

Browse files
authored
Merge pull request #83 from kiankamgar/1.x
[1.x] Improve repetitive character regex in ValidNationalCard rule
2 parents 770fe06 + 7c81a44 commit 7415423

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Rules/ValidNationalCard.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ public function passes($attribute, $value)
1919
return false;
2020
}
2121

22-
for ($i = 0; $i < 10; $i++) {
23-
if (preg_match('/^'.$i.'{10}$/', $value)) {
24-
return false;
25-
}
22+
if (preg_match('/^(.)\1*$/u', $value)) {
23+
return false;
2624
}
2725

2826
for ($i = 0, $sum = 0; $i < 9; $i++) {

0 commit comments

Comments
 (0)