Validate phone number with Symfony

Viewed 24274

I want to validate the phone nummer in a form. I would like to check so number and the "(" and ")" char are valid only. So user can fill in +31(0)600000000. The +31 is already preset in the form. The number only is possible with the code below, only how to add the two chars?

Or is there a standaard better way to validate phone number?

 @Assert\Length(min = 8, max = 20, minMessage = "min_lenght", maxMessage = "max_lenght")
 @Assert\Regex(pattern="/^[0-9]*$/", message="number_only") 
2 Answers
Related