import re


def portion_str_to_number(in_str):
    """Extract a numerical value from a portion_text field."""
    match = re.search(r"(\d+)", in_str)
    if match is not None:
        return int(match.group(1))
    return 0