[\0-9]{10,15}
I tried to match phone numbers and ended up writing that regex, and it does match phones containing +
, (
, )
, but I don't understand why.
\0
is a NUL
byte, the byte 0x0
. The range expresses the range of characters from 0x0
to "9" (0x39
), which happens to include a bunch of characters like "+". In fact, the range spans the first 58 characters of the ASCII table. See http://www.asciitable.com.
So "##########" would also match your regex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With