What does this regular expression mean?

/^1[34578]\d{9}$/
Sep.02,2021

^ 1 means it starts with 1
[345678]. It means that the second bit is a
d {9} in it, which means that the last nine digits are all integers.
$means that this is the last character, and there can be nothing else after it.

this is the rule that matches the mobile phone number, but there are some problems. Now there is 166198199 segment, which he can't cover.


Portal


this should be a regular formula that matches the mobile phone number, starting with 1, then a digit in the range of 34578, and then 9 digits, thus forming an 11-digit phone number.


keep it simple. Just write it this way. You don't have to modify

all the time.
^1\d{10}$

/ ^ 1 [34578] d {9} $/
matches the beginning of "1", and the second digit is the 11-digit number of any of the digits of "3 magi, 4 magicians, 5 pencils, 7 pencils 8".

Menu