i use this function to check if an URL is valid or not. it works for most of the cases, but here the following URL it return that is not Valid!
http://www.iphonedevsdk.com/forum/iphone-sdk-development/11841-stringbytrimmingcharactersinset.html
what can i do to improve the regular expression of my function that it will cover all URL types?
- (BOOL) urlIsValiad: (NSString *) url { NSString *regex = @"(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+"; NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; if ([regextest evaluateWithObject: url] == YES) { NSLog(@"URL is valid!"); } else { NSLog(@"URL is not valid!"); } return [regextest evaluateWithObject:url];}