Validation of expression (asp.net regular expression) through custom javascript

You can validate asp.net regular expressions using your custom javascript

var stringToValidate = document.getElementById(“txtPasswordId”).value;
            var expression= /(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,})$/;
            if (!expression.test(stringToValidate)) {
                alert(“enter valid password”);
            }

 

 

similarly you can validate any other regular expression generated by your asp.net validation controls

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.