Session Ready
Exercise

Digits, words and spaces

So far in your life you might have always searched for one number or word exactly. Now you have a much more flexible tool at hand, to search for:

  • \\d digits (zero to nine)
  • \\w word characters (letters, numbers or underscores)
  • \\s white spaces (also tabs and line breaks)

Plus, you can use square brackets [A-Za-z] and have a list of possible values inside.

You already found all sequels of "Saw". Can you create a pattern that matches all sequels in the list movie_titles? They usually have a number at the end, right?

Furthermore, the list contains duplicates introduced by "Grey" (British) and "Gray" (American English). Create a pattern that matches both versions of the color.

Lastly, list out all movie titles that contain special, non word characters.

Instructions
100 XP
  • Match all movies titles that end with a space followed by a digit.
  • Match both "Grey" and "Gray" with a custom pattern […].
  • Write a pattern that matches everything but word characters \\w and spaces \\s.