【发布时间】:2014-11-28 07:36:59
【问题描述】:
我有一个这样的字符串
#EXT-X-MEDIA-SEQUENCE:4138
#EXTINF:10.031,
media_w2031009843_4138.mp3
#EXTINF:10.031,
media_w2031009843_4139.mp3
#EXTINF:10.031,
media_w2031009843_4140.mp3
从这里我想提取这些mp3文件名,所以我这样放
NSRegularExpression *regex2 = [NSRegularExpression regularExpressionWithPattern:@"(\\w+).mp3" options:NSRegularExpressionCaseInsensitive error:&error];
[regex2 enumerateMatchesInString:strM3u81 options:0 range:NSMakeRange(0, [strM3u81 length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
//some code is there
}
但它不会进入这个区块。这是为什么。如果我的正则表达式是错误的,那我应该怎么写?
谢谢
【问题讨论】:
-
你的预期输出是什么?
标签: ios regex nsstring objective-c-blocks nsregularexpression