题解 | 电话号码格式校验
电话号码格式校验
https://www.nowcoder.com/practice/2c2453e909c04c29a04c11e9d6b2c769
select id, name, phone_number
from contacts
where phone_number regexp
'^[1-9]\\d{9}$|^[1-9]\\d{2}-\\d{3}-\\d{4}$'
;
#原来334是符合要求的 343是不符合要求的 难绷 。
电话号码格式校验
https://www.nowcoder.com/practice/2c2453e909c04c29a04c11e9d6b2c769
select id, name, phone_number
from contacts
where phone_number regexp
'^[1-9]\\d{9}$|^[1-9]\\d{2}-\\d{3}-\\d{4}$'
;
#原来334是符合要求的 343是不符合要求的 难绷 。
相关推荐