Skip to content

allowing space or dash in correct order #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# phoneregex
Regex pattern for armenian phone numbers

Current version (([+374]{4}|[0]{1}))?([1-9]{2})(\d{6})
Current version ^([+374]{4}|[0]{1})?([1-9]{2})(((-\d{3}-\d{3})|(-\d{2}-\d{2}-\d{2})|( \d{3} \d{3})|( \d{2} \d{2} \d{2}))|(\d{6}))$

Accepted + with letter number(374 possibly) OR 0 then sequence of digits with allowed range
Accepted + with letter number(374 possibly) OR 0 then sequence of digits with allowed range

Spaces, dots, dashes : NOT allowed
Spaces, dashes are allowed only in right sequence (dash followed by dash, space followed by space - separated with two-digit number օr tհree-digit number)

Other symbols are not allowed

Currenty thinking to developer version with dashes/spaces for example : +374-99-222-84 OR +374 99 22 26 84

Live demo [Regex101](https://regex101.com/r/d4DW2m/1)

Contributions are welcome
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</head>
<body>
<form action="">
<input type="tel" name="phone" pattern="(([+374]{4}|[0]{1}))?([1-9]{2})(\d{6})" required>
<input type="tel" name="phone" pattern="^([+374]{4}|[0]{1})?([1-9]{2})(((-\d{3}-\d{3})|(-\d{2}-\d{2}-\d{2})|( \d{3} \d{3})|( \d{2} \d{2} \d{2}))|(\d{6}))$" required>
<input type="submit" value="Test(page load on succeed)">
</form>
</body>
Expand Down