def split_by_regex(regex: str) -> Callable[[str], List[str]]:
    """
    Create a function that splits text using a regular expression pattern.

    Args:
        regex (str): The regular expression pattern to use for splitting.

    Returns:
        Callable[[str], List[str]]: A function that takes a string and returns a list of matches based on the regex pattern.

    """
    import re

    return lambda text: re.findall(regex, text)

    Create a function that splits text using a regular expression pattern.

    Args:
        regex (str): The regular expression pattern to use for splitting.

    Returns:
        Callable[[str], List[str]]: A function that takes a string and returns a list of matches based on the regex pattern.

    
llama-index-core/llama_index/core/node_parser/text/utils.py