from typing import Iterable
import re


def extract_ints(raw: str, negative: bool = False) -> Iterable[int]:
    """Utility function to extract all integers from some string."""
    regex = r'(-?\d+)' if negative else r'(\d+)'
    return map(int, re.findall(regex, raw))