I'm now going to give you a big assignment to push your learning a bit further. One way to speed up your education is to periodically pick something seemingly impossible and sit down to solve it for a few hours. Even if you completely fail at it, the act of trying pushes your knowledge past where you thought it could go. Sometimes though you figure out that you actually know more than you thought and you build new confidence. Doing this also gets you out of a "training rut" where you just do the same exercises over and over yet feel like you're never improving.

I've found a reasonably complex regular expression for matching IP addresses. It has most of the symbols you already know, and some that you don't know. Here's the regex you'll be working with:

\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

What you will do is this:

Extra Credit

  • Simplify this regex to a smaller one that matches the same lines.
  • Disprove this new simpler regex is "accurate" by devising a IP address that is wrong but which your new regex matches while the bigger one does not.
  • Find another regex of about the same size and convert it as well.