Z616 Comic Books and Their Readers, Spring 2025

Digital and Empirical Methods for Studying Readership and Fandom.

View project on GitHub

Regex Lab

Instructions

In this lab, you’ll practice creating regular expressions (regex). In a Word document or other text file, type your answers for the following questions.

**Note that for questions 4-8 there may be multiple answers. Just make sure your answer works! **

Avoid Googling or consulting LLMs to find answers. Use a regex tester like Regex101

  1. What are the characters to indicate the beginning and end of a string?
  2. What does the pattern b* search for?
  3. Would the regex (Alex){2,3} match the following string: “Alex”
  4. What regex would match all of the whitespaces at the ends of lines?
  5. Match dc, cc, ec, ee, dd, cd but not ad, bc, or db
  6. Match months in English ending in “y,” assuming that the months are not on separate lines as in the string below
    1. “January February March April May June July August September October November December”
  7. Select “gray” and “grey” from this list of colors: red, orange, gray, yellow, green, blue, gray, indigo, violet
  8. Write a regex which matches all the days of the week in English beginning with T, assuming a list of days on separate lines.

    To turn in

    • A document containing your answers (You can keep the questions in or not)

Turn in to the “Week 9 Lab” assignment alongside the files for the other lab you chose.