C regex for validating url

You can use this tool to test your regular expressions if you don’t have a program on your computer to do so. Alternately, convert the URL to lower case before applying this expression.I have spent quite some time trying to find a good online regular expression testing tool, but every one I have found is either too expensive, or full of advertising, so this tool is definitely worth checking out. To review the structure of the expression; the ^ symbol matches the start of the line and the $ symbol matches the end of the line.Since I’m mentioning the site, I definitely suggest browsing over to it if you are looking for further reading about regular expressions including sample code and reference material.Also, have a look at a free online regular expression tool by Derek Slager. $ For starters, you’ll want to make sure that you set your expression to ignore the case, or capital letters in a URL will cause it to fail.If you're going to allow dotted IPs you should really allow 32-bit IPs too, e.g., and In this article I’ll cover two useful regular expressions that often come in handy when writing validation logic for a Web page.Most programmers will find they need to either validate a URL or an Email at some point, and the example expressions below are the most commonly used versions of each expression.

I hope the descriptions of how they function are of use in deciphering the details of each of these two expressions.

Please feel free to add a comment with your favorite expressions for matching an email or Web address.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>