I am working on regex pattern to validate input, but I am not sure how to include () and - symbols.
Description: The input string doesn't have to be filled out. If its filled out it needs to have exactly 5 numbers and input can't start with 26. Also, input needs to accept parenthesis and dash and they can be placed in any part of the input. I accept max 10 characters
Tried:
(^(?!26)((\d){5}))?
Works only for: - empty input - exactly ten digit number for example 0123456789 - also it rejects if you have 26 at the beginning, for example 2651234567
Also, tried to include - and () but this pattern doesn't work at all
(^(?!26)(\-\(\))((\d){5}))?
Valid inputs:
(12345)--
---12)567)
12333
-1-2--3-45
(()))12345
((12345
(-)65768-
(4)1-2-35
Invalid inputs:
26123---
(26)897---
-26333----
26
26(((())
26------
26--345
26)88-76
267-9
I found discussion A comprehensive regex for phone number validation and it helped but I still can't match exactly my entry.