a RegEx for phone numbers (issue #45)

This commit is contained in:
Matteo Manzinello 2020-07-16 14:32:05 +02:00
parent cac9fa594d
commit e00c8ea975
7 changed files with 8 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/mailgo.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -992,8 +992,7 @@ var validateEmails = function validateEmails(arr) {
var validateTel = function validateTel(tel) {
// TODO: find a good regex for telephone numbers
return true;
return /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$/.test(tel);
}; // copy of a string

File diff suppressed because one or more lines are too long

View File

@ -891,10 +891,8 @@ const validateEmail = (email: string): boolean =>
const validateEmails = (arr: string[]): boolean => arr.every(validateEmail);
// validate a single tel with regex
const validateTel = (tel: string): boolean => {
// TODO: find a good regex for telephone numbers
return true;
};
const validateTel = (tel: string): boolean =>
/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$/.test(tel);
// copy of a string
const copyToClipboard = (str: string): boolean => {