Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows forms text box should accept only url name

Hi I need to validate that a textbox should accept only url names. Can anybody tell me please. I would be really thankful.

like image 644
Naveenkumar Avatar asked Oct 24 '25 03:10

Naveenkumar


1 Answers

I don´t think there is a built in method or class that you can use to validate a string as a legal url. But you can use regex, something like ["^a-zA-Z0-9-._"]+.([a-zA-Z][a-zA-Z]) If you use the code from Ranhiru you will not get it right with for instance bild.de and s.int which are both valid urls.

like image 193
bjorsig Avatar answered Oct 26 '25 18:10

bjorsig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!