Saturday, 28 November 2015

how to Use Url Image Reguler Expressation Ios/iphone

 
    NSString *searchedString = [[arr objectAtIndex: indexPath.row]
 objectForKey: @"description"];
   
    NSRange rangeOfString = NSMakeRange(0, [searchedString length]);
    //NSLog(@"searchedString: %@", searchedString);
   
    NSString *pattern = @"src=\"([^\"]+)\"";
    NSError* error = nil;
    NSTextCheckingResult* match;
    NSRegularExpression* regex = [NSRegularExpression
regularExpressionWithPattern:pattern options:0 error:&error];
    NSArray *matchs = [regex matchesInString:searchedString
options:0 range:rangeOfString];
    for (match in matchs) {
        NSLog(@"url: %@", [searchedString substringWithRange:
[match rangeAtIndex:1]]);
      
    }