diff --git a/lib/day2/day2.ex b/lib/day2/day2.ex index 24bb780..2d4597c 100644 --- a/lib/day2/day2.ex +++ b/lib/day2/day2.ex @@ -6,6 +6,13 @@ defmodule Day2 do def parse_game_number(game_string) do String.split(game_string, " ", trim: true) |> Enum.take(2) - |> List.last() |> String.replace(":", "") + |> List.last() + |> String.replace(":", "") + end + + def parse_game_sets(game_string) do + Regex.replace(~r/\bGame (\d+):\s/, game_string, "") + |> String.split(";") + |> Enum.map(&String.trim/1) end end