RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^((https?|ftp)\://((\[?(\d{1,3}\.){3}\d{1,3}\]?)|(([-a-zA-Z0-9]+\.)+[a-zA-Z]{2,4}))(\:\d+)?(/[-a-zA-Z0-9._?,'+&%$#=~\\]+)*/?)$
Description
Using other regular experssions from this page, combining others for email addresses, and mixing in my own ideas - I came up with this regular expression. Can be used to validate input into a database.
Matches
http://207.68.172.254/home.ashx | ftp://ftp.netscape.com/ | https://www.brinkster.com/login.asp
Non-Matches
htp://mistake.com/ | http://www_address.com/ | ftp://www.files.com/file with spaces.txt
Author Rating: The rating for this expression. Benjamin Gray
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: if to match example.com
Name: Zina
Date: 8/21/2007 2:14:21 AM
Comment:
nice pattern if you want to match some web pages like example.com then i would add as well smth from myself (((https?|ftp)\://|)((\[?(\d{1,3}\.){3}\d{1,3}\]?)|(([-a-zA-Z0-9]+\.)+[a-zA-Z]{2,4}))(\:\d+)?(/[-a-zA-Z0-9._?,'+&%$#=~\\]+)*/?)


Title: Check IP
Name: xMANIGHTx
Date: 5/22/2003 3:32:34 PM
Comment:
You should check for IP valuse to keep them in the 0-255 range... this exp is nice!!!


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials