Jasmine and Omar's Regex Exercises

by Jasmine Plott and Omar Kashef

30 Mar 2016

Below are our regex exercises:

Exercise 1:

Exercise 2:

Exercise 3:

These exercises were a good way for us to get more acquainted with some new concepts that were at first a bit challenging. Exercise 3 was definitely the most difficult of the exercises, but once we played around with it, figuring out the code got significantly easier. We took a lot of inspiration from the code that we used for our Files exercises and thought about how we could “translate” what we had for these exercises into something that would incorporate regular expressions. With these thoughts in mind, regular expressions in Python are truly like learning a language of their own, but they are also incredibly useful in that they allow you to be specific enough to pull out what you want from specific areas of code. Exercise 3 helped us better understand and actually interact with regular expressions, so when we got to Exercises 1 and 2, we were able to use some of what we had already experimented with (both unsuccessfully and successfully) to figure out the code for these exercises fairly quickly. This was a good pair programming exercise and helped us both better understand regular expressions.

Jasmine Plott is a first year masters student in the School of Information and Library Science at UNC Chapel Hill. She is a librarian in training and slowly developing her programming skills. Find Jasmine Plott on Twitter, Github, and on the web.
Omar is a second-year graduate student studying both Public Administration and Information Science. I'm an avid reader (current favorite books: Alice in Wonderland and Clockwork Orange) and I still play DDR. Find Omar Kashef on Twitter, Github, and on the web.