Using NSRegularExpression to extract URLs on the iPhone

后端 未结 5 611
耶瑟儿~
耶瑟儿~ 2020-11-30 09:16

I\'m using the following code on my iPhone app, taken from here to extract all URLs from striped .html code.

I\'m only being able to extract the first URL, but I nee

5条回答
  •  粉色の甜心
    2020-11-30 09:35

    Try NSDataDetector

    NSDataDetector *linkDetector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil];
    NSArray *matches = [linkDetector matchesInString:text options:0 range:NSMakeRange(0, [text length])];
    

提交回复
热议问题