Where To Go From Here?
Here is the final example project that you developed in the above tutorial.
Congratulations! You now have some practical experience with using regular expressions.
Regular expressions are powerful and fun to work with — they’re a lot like solving a math problem. The flexibility of regular expressions gives you many ways to create a pattern to fit your needs, such as filtering input strings for white spaces, stripping out HTML or XML tags before parsing, or finding particular XML or HTML tags — and much more!
There are a lot of real-world examples of strings that can be validated with regular expressions.
As a final exercise, try to untangle the following regular expression that validates an email address:
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
It looks like a jumble of characters at first glance, but with your new-found knowledge (and the helpful links below) you’re one step closer to understanding it and becoming a master of regular expressions!
Here is a short list of some useful resources about regular expressions:
I hope you enjoyed this NSRegularExpression tutorial and cheat sheet, and if you have any comments or questions, please join the forum discussion below!