Regular Expressions are a vital part of most developer's toolkits and can be incredibly useful when processing text strings. Apple recently introduced regular expressions at WWDC 2010 for iOS 4.0 as the framework NSRegularExpression. I've recently started working with this framework for a project that does some web scraping and created some functions that I think would be useful to most iOS devs.
This first example will take in a string and will return the first match it finds to the specific regular expression syntax, in this example that expression will find all http URLs.
The second example will take a regex pattern, find it in the given string and substitute all matches for that pattern creating a new string when done. The sample function below will find all whitespace and substitute it for '&'.