Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <iframe width="1280" height="720" src="http://www.youtube.com/embed/Pb55ep-DrSo?wmode=opaque&autoplay=1&fs=1&feature=oembed&showinfo=0&autohide=1&controls=0" frameborder="0" allowfullscreen></iframe>
- NSString* str = @"<iframe width="1280" height="720" src="http://www.youtube.com/embed/Pb55ep-DrSo?wmode=opaque&autoplay=1&fs=1&feature=oembed&showinfo=0&autohide=1&controls=0" frameborder="0" allowfullscreen></iframe>";
- str = [str substringFromIndex:[str rangeOfString:@"src=""].location+[str rangeOfString:@"src=""].length];
- str = [str substringToIndex:[str rangeOfString:@"""].location ];
- NSLog(@"Str %@",str);
- 2012-08-17 09:16:55.285 TEST[24413:c07] Str http://www.youtube.com/embed/Pb55ep-DrSo?wmode=opaque&autoplay=1&fs=1&feature=oembed&showinfo=0&autohide=1&controls=0
- src[s]*=[s]*"([^"]*)"
- NSString *searchedString = @"<iframe width="1280" height="720" src="http://www.youtube.com/embed/Pb55ep-DrSo?wmode=opaque&autoplay=1&fs=1&feature=oembed&showinfo=0&autohide=1&controls=0" frameborder="0" allowfullscreen></iframe>";
- NSError* error = nil;
- NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:@"src[s]*=[s]*"([^"]*)"" options:0 error:&error];
- NSArray* matches = [regex matchesInString:searchedString options:0 range:NSMakeRange(0, [searchedString length])];
- for ( NSTextCheckingResult* match in matches )
- {
- NSString* matchText = [searchedString substringWithRange:[match range]];
- NSLog(@"match: %@", matchText);
- NSRange group1 = [match rangeAtIndex:1];
- NSLog(@"group1: %@", [searchedString substringWithRange:group1]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement