Click here to Skip to main content
15,913,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to set a validation expression for url
my expression is http://www.facebook.com
i dont want this http:// it should be simple www.facebook.com
i m using this but it stil takes ([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)? if i simply insert aa.a can any one help me plz????
Posted

1 solution

Hi,

You can use below expression for the same,

^((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?$


Hope it will solve your issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900