One More Exercise…
There are a lot of real-world examples of strings that you can validate 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!
More Resources
Here is a short list of some useful resources about regular expressions:
I hope you enjoyed this NSRegularExpression tutorial, and if you have any comments or questions, please join the forum discussion below!