(self, format)
return "%s%s" % (processed_format, format)
Return regex pattern for the format string.

        Need to make sure that any characters that might be interpreted as
        regex syntax are escaped.
Return regex pattern for the format string.
Return regex pattern for the format string .
def pattern(self, format):
        """Return regex pattern for the format string.

        Need to make sure that any characters that might be interpreted as
        regex syntax are escaped.

        """
        processed_format = ''
        # The sub() call escapes all characters that might be misconstrued
        # as regex syntax.  Cannot use re.escape since we have to deal with
        # format directives (%m, etc.).
        regex_chars = re_compile(r"([\\.^$*+?\(\){}\[\]|])")
        format = regex_chars.sub(r"\\\1", format)
        whitespace_replacement = re_compile(r'\s+')
        format = whitespace_replacement.sub(r'\\s+', format)
        while '%' in format:
            directive_index = format.index('%')+1
            processed_format = "%s%s%s" % (processed_format,
                                           format[:directive_index-1],
                                           self[format[directive_index]])
            format = format[directive_index+1:]
        return "%s%s" % (processed_format, format)
def pattern ( self , format ) : processed_format = '' # The sub() call escapes all characters that might be misconstrued # as regex syntax.  Cannot use re.escape since we have to deal with # format directives (%m, etc.). regex_chars = re_compile ( r"([\\.^$*+?\(\){}\[\]|])" ) format = regex_chars . sub ( r"\\\1" , format ) whitespace_replacement = re_compile ( r'\s+' ) format = whitespace_replacement . sub ( r'\\s+' , format ) while '%' in format : directive_index = format . index ( '%' ) + 1 processed_format = "%s%s%s" % ( processed_format , format [ : directive_index - 1 ] , self [ format [ directive_index ] ] ) format = format [ directive_index + 1 : ] return "%s%s" % ( processed_format , format )