(self, text)
return r'(?P<abbr>\b%s\b)' % (r''.join(chars))
Given a string, returns an regex pattern to match that string. 
        
        'HTML' -> r'(?P<abbr>[H][T][M][L])' 
        
        Note: we force each char as a literal match (in brackets) as we don't 
        know what they will be beforehand.
Given a string, returns an regex pattern to match that string. 
        
        'HTML' -> r'(?P<abbr>[H][T][M][L])' 
        
        Note: we force each char as a literal match (in brackets) as we don't 
        know what they will be beforehand.
Given a string returns an regex pattern to match that string . HTML - > r ( ?P<abbr > [ H ] [ T ] [ M ] [ L ] ) Note : we force each char as a literal match ( in brackets ) as we don t know what they will be beforehand .
def _generate_pattern(self, text):
        '''
        Given a string, returns an regex pattern to match that string. 
        
        'HTML' -> r'(?P<abbr>[H][T][M][L])' 
        
        Note: we force each char as a literal match (in brackets) as we don't 
        know what they will be beforehand.

        '''
        chars = list(text)
        for i in range(len(chars)):
            chars[i] = r'[%s]' % chars[i]
        return r'(?P<abbr>\b%s\b)' % (r''.join(chars))
def _generate_pattern ( self , text ) : chars = list ( text ) for i in range ( len ( chars ) ) : chars [ i ] = r'[%s]' % chars [ i ] return r'(?P<abbr>\b%s\b)' % ( r'' . join ( chars ) )