public static bool IsValidUrl(this string url)
{
string strRegex = "^(https?://)"
+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" // user@
+ @"(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP- 10.0.0.1
+ "|" // allows either IP or domain
+ @"([0-9a-z_!~*'()-]+\.)*" // tertiary domain(s)- www.
+ @"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]" // second level domain
+ @"(\.[a-z]{2,6})?)" // first level domain- .com or .museum is optional
+ "(:[0-9]{1,5})?" // port number- :80
+ "((/?)|" // a slash isn't required if there is no file name
+ "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
return new Regex(strRegex).IsMatch(url);
}
Validate input URL string
Subscribe to:
Post Comments
(
Atom
)
Popular Posts
-
I have just recently passed my PSM I certificate test from Scrum.org . Luckily my score was 95% at first attempt so I would like to shar...
-
Recently, I was trying to update our internal system from ExtJs 3 to version 4. Well, I think many V3 plugins are needed to be updated...
-
I have been using ASP .NET MVC for many years. It is a complex framework but not difficult to learn (at least for .NET developers). An...
-
Recently, I had problems to install UFRaw plug-in for Gimp on both of my Windows 7, 8 and my Macbook Pro (Mountain Lion). Well, after googl...
-
Last week I updated my Blogger site to be responsive and optimised the page load time . Whilst doing those optimisation, I was looki...
Categories
Coding
(
17
)
Tips
(
11
)
Javascript
(
8
)
C#
(
6
)
ExtJs
(
6
)
NETCF
(
5
)
Windows Mobile
(
5
)
Blogger
(
4
)
PHP
(
4
)
Linux
(
3
)
MySQL
(
3
)
Ubuntu
(
3
)
Android
(
2
)
Apache
(
2
)
CSS
(
2
)
Html
(
2
)
Minify
(
2
)
jQuery
(
2
)
Agile
(
1
)
C++
(
1
)
Exchange
(
1
)
Gimp
(
1
)
Life
(
1
)
Mac
(
1
)
Scrum
(
1
)
Buy me a cuppa
Thank you for visiting my blog.
If you'd like to support me,
you can buy me a cuppa.
If you'd like to support me,
you can buy me a cuppa.

0 comments :
Post a Comment