02 Years

An example of something that is much harder to do with regular expressions than by other means.

Years before 1990

Match titles of all films produced before 1990.

1 The Shawshank Redemption (1994)
2 The Godfather (1972)
3 The Godfather: Part II (1974)
4 Pulp Fiction (1994)
5 The Good, the Bad and the Ugly (1966)
6 The Dark Knight (2008)
7 12 Angry Men (1957)
8 Schindler's List (1993)
9 The Lord of the Rings: The Return of the King (2003)
10 Fight Club (1999)

You should match lines 2, 3, 5, and 7.

Original source.

Doing this with a parser (like Lark) was still an interesting exercise.

Of course the simple way is to just match the date in each line with \(([0-9]+)\) and then use the contents of the match group to make a decision.

Last modified March 15, 2024: Parsing unit. (015098c)