/* AoC Utilities for regex related stuff in Picat. Utilities using my regex library https://github.com/hakank/picat_regex Also see aoc_utils.pi This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ module aoc_utils_regex. import util. import regex. /* Find all numbers in a string (an entry) Example: Picat> Ns="Button A: X+94, Y+34\nButton B: X+22, Y+67\nPrize: X=8400, Y=5400".find_all_numbers() Ns = [94,34,22,67,8400,5400] */ % find_all_numbers(S) = regex_find_all("(\\d+)",S).map(to_int). find_all_numbers(S) = regex_find_all("([-+\\d]+)",S).map(to_int).