From a post I wrote over at my employer's developer blog:
I have a love/hate relationship with regular expressions. I love them because they’re great for examining text to find useful information and, often, to change the text in some way. I hate them because once you get beyond basic matching, they descend into bizarre write-only code that gives me flashbacks to my days writing Perl. In extreme cases they may well endanger the universe. And so we come to one of my recent coding issues: How can I find out if a string contains a valid email address?
Go read the whole thing.
NSDataDetector seems to be an under-appreciated class on iOS and macOS. You'll be glad to know about it, even if you don't need it right now.
Update: This post was featured in iOS Dev Weekly #325, which is just awesome to see.
Update 2: This post was featured in Swift Weekly, which is another shot of awesome.