正则表达式匹配以1开头的九位数字(Regular expression to match nine-digit numbers that start with a 1)

我试图匹配以1开头的9位数字

"/^1[0-9]{9}$/"

I am trying to match 9-digit numbers that start with a 1

"/^1[0-9]{9}$/"

最满意答案

/^1\d{8}/

第一个数字1将是您的第一个数字,因此量词应为8。

/^1\d{8}/

The first number 1 will be your first digit, so the quantifier should be 8.

正则表达式匹配以1开头的九位数字(Regular expression to match nine-digit numbers that start with a 1)

我试图匹配以1开头的9位数字

"/^1[0-9]{9}$/"

I am trying to match 9-digit numbers that start with a 1

"/^1[0-9]{9}$/"

最满意答案

/^1\d{8}/

第一个数字1将是您的第一个数字,因此量词应为8。

/^1\d{8}/

The first number 1 will be your first digit, so the quantifier should be 8.