Advanced - Regex Fall 2026

Submission Instructions

This homework will be submitted as a repository on the EECS GitLab server. The repository you submit will be a private Project with the name/path eecs201-adv-regex with akamil added as a Reporter. The branch latin will be the one that is checked.

To finish the submission process and get your submission score, you will need to run the autograder. You will need to SSH into the course server (see Basic - Intro):

local$ ssh uniqname@peritia.eecs.umich.edu

(the local$ referring to a shell prompt on your system)

and then run eecs201-test:

peritia$ eecs201-test adv-regex

(the peritia$ referring to a shell prompt on the server)

The repository should have the following directory structure, starting from the repository’s root:

/
|-- report.txt
|-- pig-latinfy.sh

Presentation/Checkoff

In addition to submitting this assignment, you will need to attend a lab session after the deadline to discuss your work with the course staff. Refer to the course schedule for the window for doing so for this assignment.

As part of the discussion, be prepared to do the following:

I suggest keeping these in mind while doing the assignment, and writing down your thoughts so that you can review them before the checkoff.

Your overall score for the assignment will be a combination of your submission score and the presentation/checkoff score. Refer to the syllabus for the details.

Preface

Really important preface here! Please read! Some implementations of POSIX standard tools go above and beyond what the specification describes, adding additional functionality. For many of the tools that the GNU Project implements, there are additional features that aren’t in the POSIX spec. This assignment takes advantage of some of these additional features in GNU sed .

Why is this important? Linux systems use GNU utilities while macOS systems use BSD utilities (BSD being a Unix which macOS is ultimately derived from). For macOS users, the next few sentences will be critical. For Windows/WSL/Linux users, it’s additional fun knowledge. Have no fear if you’re a macOS user: you can use the Homebrew package manager to acquire the GNU versions of utilities (technically you can get the source code of the GNU utilities yourself, but Homebrew is pretty neat and if you’re into that sort of thing, I’m confident you can figure out how to manually build them ;)! Chances are you already have installed Homebrew to install some other software on your Mac, but if you haven’t you can find the instructions to install it here: https://brew.sh/ (when the installation completes, be sure to follow the followup steps on the terminal for adding the Homebrew managed directories to your PATH!). The gnu-sed Homebrew package provides the GNU sed that will be extremely helpful for this assignment. This package will provide GNU sed as the gsed command. Now this gives us a slight issue: the reference system for this class is Linux, which simply has the sed command running GNU sed and no such gsed command. In this assignment you’ll be writing a shell script: what you can do is add a bit of system detection at the beginning:

# for Mac users using gnu-sed from Homebrew
if [ $(uname) = "Darwin" ]; then
  shopt -s expand_aliases # needed if the shebang uses Bash
  alias sed=gsed
fi

This uses uname to get the OS of the system the script is running on: Linux systems will output “Linux” while macOS systems will output “Darwin”. This will “alias” sed to gsed, allowing you to transparently refer to gsed as sed in our script. The shopt -s expand_aliases will allow aliases to work from within a script (non-interactive) environment if you’re setting your script to use Bash.

If you don’t want to use Homebrew or install GNU sed on your Mac, feel free to do the assignment on the course server, which serves as the reference environment.

In this assignment you’ll be provided yet another zipped archive containing some sample input data as well as the expected data as well a starter pig-latinfy.sh. Use your preferred tool to retrieve this file and extract it (see Basic - Git 1 if you need a review).

https://www.eecs.umich.edu/courses/eecs201/fa2026/files/assignments/adv-regex.tar.gz

Initialize a Git repository in the extracted adv-regex directory, following the submission instructions.

More sed fun (10)

Pig Latin is a language game in which English words are made to sound like a faux-Latin by moving around groupings of letters.

Here are the basic rules for this exercise’s variant:

  1. For words that begin with a single consonant before running into a vowel, the consonant is moved to the end and “ay” is added after.

    • “hello” = “ellohay”

    • “cat” = “atcay”

    • “liquid” = “iquidlay”

  2. For words that begin with a multiple consonants before running into a vowel, the consonant group is moved to the end and “ay” is added after.

    • “string” = “ingstray”

    • “friend” = “iendfray”

    • “wrong” = “ongwray”

  3. For words that begin with a vowel, “yay” is simply added at the end.

    • “I” = “Iyay”

    • “apply” = “applyyay”

    • “income” = “incomeyay”

  4. For this Pig Latin variant, the letter ‘y’ is always a consonant. For your convenience, consonants are
    BCDFGHJKLMNPQRSTVWXYZ
    and vowels are
    AEIOU

  5. If the word contains no vowels, then leave the word alone.

For this exercise, write an executable shell/Bash script called pig-latinfy.sh that takes its input on standard input and turns it into Pig Latin and outputs the translation on standard output. Be sure to set the shebang appropriately! If you are on WSL and doing this on the Windows filesystem, be sure to have Git set the execute bits (look up how to do this)! The big caveats are:

The adv-regex directory has example text and their translated versions for reference.

Helpful hints

Conclusion

  1. Add and commit any changes you intend to submit.

  2. Create a file called report.txt.

  3. On the first line provide an integer time in minutes of how long it took for you to complete this assignment.

  4. On the second line and beyond, write down what you learned while doing this assignment. If you already knew how to do all of this, put down “N/A”.

  5. Add and commit this report.txt file.