为什么我的电话号码验证正则表达式不起作用? [重复]

Possible Duplicate:
Phone number validation in PHP

Yes iam an Regular Expression newb (-:

This one validates an Phone Number in the format: +00 000 00000 but it should altough validate +000000000 without an space.

I have dont try & error, but without success (-:

 $pattern = '((^\+[1-9][0-9]{0,2}(\s+[1-9][0-9]*)?\s+([0-9]+)$)|(^([0][0-9]*)?\s+([0-9]+)$))';

You can change each \s+ to \s* and it should do what you want.

The + there tells the regex to match \s one or more times. The * tells the regex to match \s zero or more times.

Why not just remove the whitespace first and then use something simple?