Project

General

Profile

« Previous | Next » 

Revision 12742

bin/repl: text mode: also match w/ suffix (eg. _verbatim)

View differences:

repl
48 48
                in_str_re = re.escape(in_)
49 49
                q = quote_re
50 50
                in_ = '(?<='+q+')'+in_str_re+'(?='+q+')' # require quotes
51
                if is_word: # also match without quotes
52
                    in_word_re = '(?<!'+q+r')\b'+in_str_re+r'\b(?!'+q+')'
53
                        # don't match as partial part of quoted string
51
                if is_word: # also match with quotes optional
52
                    in_word_re = r'\b'+in_str_re+r'(?=\b|_)' # also w/ suffix
54 53
                    in_ = '(?:'+in_+'|'+in_word_re+')'
55 54
            repls.append((r'(?m)'+in_, out))
56 55
    stream.close()

Also available in: Unified diff