- (BOOL)isUrlAddress:(NSString*)url
{
NSString*reg =@"((http[s]{0,1}|ftp)://[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)|(www.[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)";
NSPredicate*urlPredicate = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@", reg];
return[urlPredicateevaluateWithObject:url];
}
网友评论