I have pattern code: ^[1-9]{2}9?[0-9]{8}$
, so I changed my mind to do with regex with mask and such ...
Example:
- (11) 1111-1111 -
fixo válido
- (11) 11111-1111 -
celular inválido
- (11) 91111-1111 -
celular válido
- (11) 01111-1111 -
celular inválido
Format: 2-character DDD (9th digit is optional). If you start with 9 digits, you should start with number 9.
How can I do this in regex?
Here's a regex ready that I could not do: link