diff --git a/src/scripts/contact-form.js b/src/scripts/contact-form.js index 8c53ba9..f7082af 100644 --- a/src/scripts/contact-form.js +++ b/src/scripts/contact-form.js @@ -88,9 +88,9 @@ form.addEventListener("submit", function(event) { } // Phone — match format: 123-456-7890 - const phonePattern = /^\d{3}-\d{3}-\d{4}$/; + const phonePattern = /^(\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4})$/; if (!phonePattern.test(phone)) { - showError("phone", "Phone number must be in the format 123-456-7890."); + showError("phone", "Phone number format is invalid."); hasErrors = true; }