“Simple” string matching fun with regular expressions

I'm still yet to get my head around the power of regular expressions.

I had a problem where I was trying to match a particular image name, only there were multiple variations.

  • _side.jpg
  • _side_1.jpg
  • _side_2_1.jpg

My regular expression looked like this '/_side*\.jpg$/' but clearly there was a problem with it so I called on a friend to help me understand it. (Thanks Geoff) Continue reading