更新时间:2023-02-23 13:08:08
不需要使用 RegexKitLite
,因为iOS 4 Apple提供 NSDataDetector
( NSRegularExpression )。
No need to use RegexKitLite
for this, since iOS 4 Apple provide NSDataDetector
(a subclass of NSRegularExpression
).
您可以像这样使用它( source
是你的字符串):
You can use it simply like this (source
is your string) :
NSDataDetector* detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil];
NSArray* matches = [detector matchesInString:source options:0 range:NSMakeRange(0, [source length])];