Project

General

Profile

« Previous | Next » 

Revision 564

repl: When matching words, treat _ as word boundary and ignore case.

View differences:

repl
24 24
    for row in reader:
25 25
        in_, out = row[:2]
26 26
        if in_ != '':
27
            if re.match(r'^\w+$', in_): in_ = r'\b'+in_+r'(?=(?:(?i)_id)?\b)'
28
                # match whole word
27
            if re.match(r'^\w+$', in_):
28
                in_ = r'(?i)(?<![^\W_])'+in_+r'(?![^\W_])' # match whole word
29 29
            repls.append((in_, out))
30 30
    stream.close()
31 31
    def repl_all(str_):

Also available in: Unified diff