~/ learn/ comp-325/ cards/ Regular expressions: literals plus operators
1 of 9

Run the three worked-example patterns over the candidate file

Run the three worked-example patterns over the candidate file

Answer

grep -E 'a|bc*' candidates grep -E '(a|b)*' candidates grep 'L..e' candidates

The first prints every line containing an a, or a b with any number of trailing c characters. The second prints all six lines, because zero repetitions is a legal match and every line contains the empty string. The third needs a literal L, exactly two characters, then a literal e.

Sarwar & Koretsky 3e ch7 §7.5; POSIX.1-2024 XBD §9 (BRE and ERE)

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/91c84bee-682d-4907-af94-d9d7d7261d4a/flashcard utf-8 LF