Project

General

Profile

« Previous | Next » 

Revision 10278

bin/*: replaced confusing regexp constructs involving \W inside [] with the much clearer explicit character class [:alnum:] . this avoids adding or subtracting from an inverted class in order to reach a subset of the corresponding positive class, because the subset can just be named explicitly instead.

View differences:

repl
43 43
        if in_ != '':
44 44
            if text or re.match(r'^\w+$', in_): # match word
45 45
                in_ = (r'(?:^|(?<=[\s,"])|^:|(?<=[\s,"]):)'+re.escape(in_)
46
                    +r'(?![^\W_])')
46
                    +r'(?![[:alnum:]])')
47 47
            repls.append((r'(?m)'+in_, out))
48 48
    stream.close()
49 49
    def repl_all(str_):

Also available in: Unified diff