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