Fax Number validation using RegularExpression (Regex) and JavaScript

Last Reply one year ago By dharmendr

Posted one year ago

any one send regular expression for fax validation.


Posted one year ago Modified on one year ago

Hi Bhargav,

This is the regular expression for fax format like

+(country code)-(area code)-(fax number)

var regex = new RegExp("\\+[0-9]{1,3}-[0-9]{3}\\-[0-9]{7}");


var regex = new RegExp("^\\+[0-9]{1,3}-[0-9]{3}-[0-9]{7}$");


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript">
        function ValidateFax() {
            var regex = new RegExp("^\\+[0-9]{1,3}-[0-9]{3}-[0-9]{7}$");
            var fax = document.getElementById("txtFax").value;
            if (fax != '') {
                if (regex.test(fax)) {
                    alert("Fax no is valid");
                } else {
                    alert("Fax no is invalid");
            } else {
                alert("Enter Fax no.");
    <form id="form1" runat="server">
        <input id="txtFax" type="text" />
        <input type="button" onclick="ValidateFax()" value="Validate" />



I agree, here is the link: http://e-iceblue.com/free-api