in reply to Re^5: RegEx Question
in thread RegEx Question
/ ^ (?=.*0) (?=.*1) (?=.*2) (?=.*3) (?=.*4) (?=.*5) (?=.*6) (?=.*7) (?=.*8) .{9}\z /sx;
I figured it would be faster to check the length and for the presence of invalid characters first, and I left the last one as a lookahead for symmetry.
Note that this is basically the trick for doing "and" in regex matches. My original solution is roughly the same as
/^[0-8]{9}\z/ && /0/ && /1/ && /2/ && /3/ && /4/ && /5/ && /6/ && /7/ && /8/
|
|---|