Have you been avoiding regular expressions because you think they're too confusing? Are you copying and pasting snippets from Stack Overflow into your code but you're not really sure what they mean?
Well, there many great resources available for free that will have you writing regular expressions without fear in no time.
In Beneath the Surface: Regular Expressions in Ruby from GoGaRuCo, Nell Shamrell's humor and clear explanation take you through the process of how regex works step by step. If you've used regex to match a string but had no idea how it worked, this is a great starting point.
Tutorials & resources
As a supplement to her talk, check out Nell’s three part post on the Bluebox blog.
If you need something that's a bit more "step-by-step" tutorial, try something like RegexOne for some interactive lessons, real world examples, and a PHP Regular Expressions cheat sheet.
Another student favorite is Rexegg to walk through foundations and more.
Resources to practice
The best follow up for a deep dive talk like this is through practice. If you have a problem you’re trying to solve currently check out one of these Regular Expression editor sites to practice:
- Rubular - an excellent Ruby regular expression editor & my first choice for testing
- Rubyxp - a Ruby regex tester
- Python Regex Tester - a Python specific regex tester
Regex for fun
- Regex Crossword Interactive regex crossword game with challenges for all skill levels.
- Regex Golf Regex matching game with 16 levels.
- Expressions - This interactive game is free for the first 10 lessons with additional levels available for a charge.
Problems to try and solve
If you don't have a current problem requiring regex try one of these to build up some experience:
- Match a phone number
- Match a name
- Reformat a file name
- Email validation
- URL validation