Regular expression for validating url
:\.\d))" // IP address dotted notation octets // excludes loopback network 0.0.0.0 // excludes reserved space = 22.214.171.124 // excludes network & broacast addresses // (first & last IP address of each class) "(?
:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9] )" // domain name "(?
=.*\d) # must contain at least one numeric character (?
=.*[a-z]) # must contain one lowercase character (? # From 8 to 10 characters in length \s # allows a space $ # anchor at the end", Regex Options.
Regular expressions are much easier to understand if you use the following syntax and comment each component of the expression by using a number sign (#).
To enable comments, you must also specify Regex Options.
Regex regex = new Regex(@" ^ # anchor at the start (?
You can use them to constrain input, apply formatting rules, and check lengths. This How To shows how you can use regular expressions within ASP. Objectives Overview Using a Regular Expression Validator Control Using the Regex Class Common Regular Expressions Additional Resources If you make unfounded assumptions about the type, length, format, or range of input, your application is unlikely to be robust.