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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find URL
Expression
^(http|https|ftp|ftps)\://([a-zA-Z0-9\-]+)(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]{2,3})(:[0-9]*)?(/[a-zA-Z0-9_\-]*)*(\.?[a-zA-Z0-9#]{1,10})?([\?][a-zA-Z0-9\-\._\,\'\+&%\$#\=~]*)?$
Description
Matches basic URL strings with optional query string. Remarks: to use this expression in JavaScript you should do the following: 1) when using RegExp("pattern") object you should escape all '\' instances, because they appear in double quotes. 2) when using /pattern/flags syntax, you should escape all '/' instances, because this character indicates an end of an expression.
Matches
http://example.com https://www.example.com:8080/path/path/ http://www.example.com/path/page.html?p1=param1&p2=param2
Non-Matches
example.com http://example.c http://example.com/page.
Author Rating: Not yet rated. Dmitry Tranchenko
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

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