Validating US phone number with php/regex

后端 未结 5 558
误落风尘
误落风尘 2020-11-30 08:11

EDIT: I\'ve mixed and modified two of the answers given below to form the full function which now does what I had wanted and then some... So I figured I

5条回答
  •  醉酒成梦
    2020-11-30 08:46

    Why not convert any series of letters to be "x". Then that way you would have all possibilities converted to be "x".

    OR

    Check for 3digits, 3digits, 4digits, 1orMoreDigits and disregard any other characters inbetween

    Regex: ([0-9]{3}).*?([0-9]{3}).*?([0-9]{4}).+?([0-9]{1,})

提交回复
热议问题