Regular Expressions In-Class Assignment

by Natalia Lopez and Javairia Warrich

30 Mar 2016

Exercise 1:

Exercise 2:

Exercise 3:

Reflection: (Nat) Exercise 1 was pretty straight forward once I referred back to the text and realized I could use re.search(). However, I was frustrated that I couldn’t figure out how to make it so that it would only look for the word that was inputted rather than the letters (i.e. if I tested it with the word ‘cat,’ it would count words that just had the letters ‘cat’ together within the whole word.) I used \b after struggling for a long time with how to put together the statement and think that should work.

(Javairia)Exercise 2 was similar to the the examples given in the book. The only difference was finding the average. I recalled that we had to do find the average in a previous exercise and did something similar to that. Exercise 3 was a little confusing when we initially started it. For me the hardest part was figuring out how to print all the rows that contained the expression.

(Nat & Javaira) It took quite some time to figure this one out! The main issue we had was figuring out how to isolate the rows. We didn’t remember that we had to break up the list into another list. Once we realized that, we were able to pretty easily create the for statements to return the rows with the input column and regex that matched.

Nat (batlopez) is a first year MSLS student interested in digital research services. Find Natalia Lopez on Twitter, Github, and on the web.
Javairia is a Junior majoring in Information Science at UNC Chapel Hill. Her hobbies include watching sports (Go Panthers!) and reading. Find Javairia Warrich on Twitter, Github, and on the web.