import re


def _createNameReplacement(search, replace):
    """
    Return a tuple containing a regex and replacement string.
    Regexes replace prefixes, suffixes, or middles, as long as
    the search is separated with '_' from adjacent characters.
    """
    regex = re.compile('(?<![^_]){0}(?=(_|$))'.format(search))
    return (regex, replace)