import re


def parse_by_named_regexp(regexp, val):
    """Parses val according to named regexp. Return a dictionary of params.
    """
    matching = re.search(regexp, val)
    if matching is None:
        return None
    return matching.groupdict()