def subfn(pattern, format, string, count=0, flags=0, pos=None, endpos=None, concurrent=None, **kwargs): """Wrapper for subfn.""" return regex.subfn( _apply_search_backrefs(pattern, flags), format, string, count, flags, pos, endpos, concurrent, **kwargs )
def subfn(pattern, format, string, count=0, flags=0, pos=None, endpos=None, concurrent=None, **kwargs): """Wrapper for subfn.""" return regex.subfn( _apply_search_backrefs(pattern, flags), format, string, count, flags, pos, endpos, concurrent, **kwargs )
def decode_text(text): ''' Replaces %-escaped hexadecimal text with its proper character. ''' change = lambda x: chr(int('0x' + x.group()[1:], 16)) new_text, number_substitutions = regex.subfn(r'(%[0-9A-F]{2})', change, text) return new_text