def regex_to_sql_like(regex_text: str,
                          single_wildcard: str = "_",
                          zero_or_more_wildcard: str = "%") -> List[str]:
        """
        Converts regular expression text to a reasonably close fragment
        for the SQL ``LIKE`` operator.

        NOT PERFECT, but works for current built-in regular expressions.

        Args:
            regex_text: regular expression text to work with
            single_wildcard: SQL single wildcard, typically an underscore
            zero_or_more_wildcard: SQL "zero/one/many" wildcard, probably always
                a percent symbol

        Returns:
            string for an SQL string literal

        Raises:
            :exc:`ValueError` for some regex text that it doesn't understand
            properly
        """
        def append_to_all(new_content: str) -> None:
            nonlocal results
            results = [r + new_content for r in results]

        def split_and_append(new_options: List[str]) -> None:
            nonlocal results
            newresults = []  # type: List[str]
            for option in new_options:
                newresults.extend([r + option for r in results])
            results = newresults

        def deduplicate_wildcards(text: str) -> str:
            while zero_or_more_wildcard + zero_or_more_wildcard in text:
                text = text.replace(
                    zero_or_more_wildcard + zero_or_more_wildcard,
                    zero_or_more_wildcard)
            return text

        # Basic processing
        working = regex_text  # strings are immutable
        results = [zero_or_more_wildcard]  # start with a wildcard

        while working:
            if working.startswith(".*"):
                # e.g. ".*ozapi"
                append_to_all(zero_or_more_wildcard)
                working = working[2:]
            elif working.startswith("["):
                # e.g. "[io]peridol"
                close_bracket = working.index("]")  # may raise
                bracketed = working[1:close_bracket]
                option_groups = bracketed.split("|")
                options = [c for group in option_groups for c in group]
                split_and_append(options)
                working = working[close_bracket + 1:]
            elif len(working) > 1 and working[1] == "?":
                # e.g. "r?azole"
                split_and_append(["", working[0]])
                # ... regex "optional character"
                # ... SQL: some results with a single wildcard, some without
                working = working[2:]
            elif working.startswith("."):
                # single character wildcard
                append_to_all(single_wildcard)
                working = working[1:]
            else:
                append_to_all(working[0])
                working = working[1:]
        append_to_all(zero_or_more_wildcard)  # end with a wildcard

        # Remove any duplicate (consecutive) % wildcards:
        results = [deduplicate_wildcards(r) for r in results]

        # Done
        return results
Converts regular expression text to a reasonably close fragment
        for the SQL ``LIKE`` operator.

        NOT PERFECT, but works for current built-in regular expressions.

        Args:
            regex_text: regular expression text to work with
            single_wildcard: SQL single wildcard, typically an underscore
            zero_or_more_wildcard: SQL "zero/one/many" wildcard, probably always
                a percent symbol

        Returns:
            string for an SQL string literal

        Raises:
            :exc:`ValueError` for some regex text that it doesn't understand
            properly