0

Possible Duplicate:
How to validate an url on the iPhone

Can anyone let me know how to validate a website name in UITextfield? Thanks in advance

Community
  • 1
  • 1
Vijay
  • 420
  • 6
  • 18
  • Validate in what way? That it's a valid http-protocol URL, or that it's a reachable site? – Michael Petrotta Aug 21 '11 at 06:48
  • that is for url validation i need website name validation say for example "www.vijay.com" need to validate whether it is a valid website name that has www . and . com like we are having number of wesite names i need only the name validation i dont care whether it exists or not. can you provide me with the validation that i am looking for? thanks – Vijay Aug 21 '11 at 07:05
  • Vijay, see the link above. Note that few websites use the `www` subdomain anymore, and there are lots and lots of top-level domains other than `com`. – Michael Petrotta Aug 21 '11 at 07:06
  • Yup, you are right. i need the predicate that check whether the user entered the valid website name. No matter that the website exists or not i just need that the user has entered some website name which looks like a website name. I hope this time i explained my problem properly. – Vijay Aug 21 '11 at 07:12
  • Go to this [LINK](http://stackoverflow.com/questions/1471201/how-to-validate-an-url-on-the-iphone) – rptwsthi Aug 21 '11 at 09:12
  • - (BOOL)validateWebsiteWithString:(NSString*)website { NSString *webRegex = @"((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+"; NSPredicate *webTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", webRegex]; return [webTest evaluateWithObject:website]; } – Vijay Nov 21 '11 at 05:06

0 Answers0