views:

140

answers:

1

Hello all, I have a UITextView in which i have 5 hyperlinks and 5 phone numbers.How do i get all those hyperlinks and phone numbers in a NSarray?

+1  A: 

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!

andyvn22