preg_match: nothing to repeat / no match

前端 未结 2 1289
悲&欢浪女
悲&欢浪女 2021-01-17 20:28

I am using this: if(!preg_match(\'/^+[0-9]$/\', \'+1234567\'))

and am getting:

Warning: preg_match() [function.preg-match]:

2条回答
  •  鱼传尺愫
    2021-01-17 20:53

    '/^\+[0-9]$/' means that begining of the line has to be plus sign folowed by a number then end of line.

    '/^\+[0-9]+$/' means that begining of the line has to be plus sign folowed by a one or more numbers then end of line.

提交回复
热议问题