I have a UITextView in which i have 5 hyperlinks and 5 phone number开发者_运维百科s.How do i get all those hyperlinks and phone numbers in a NSarray?
One option is to use RegexKitLite's componentsMatchedByRegex:
method. You can then use a regular expression to find the appropriate parts of the text, and you'll get the results returned as an array.
You can use RegExr to experiment with your specific regular expressions, and use the "Community" to find pre-built regular expressions that find phone numbers and hyperlinks. (They're there, I checked!)
RegexKitLite compiles right into your app, so there's no problem using it on the iPhone. Good luck!
精彩评论