Revision 216
Added by Aaron Marcuse-Kubitza about 13 years ago
repl | ||
---|---|---|
23 | 23 |
repl_in, repl_out = reader.next()[:2] |
24 | 24 |
for row in reader: |
25 | 25 |
in_, out = row[:2] |
26 |
if not re.match(r'[\\(?]', in_): # no special regexp chars |
|
27 |
in_ = r'\b'+in_+r'(?=(?:(?i)_id)?\b)' # match whole word |
|
28 |
repls.append((in_, out)) |
|
26 |
if in_ != '': |
|
27 |
if re.match(r'^\w+$', in_): in_ = r'\b'+in_+r'(?=(?:(?i)_id)?\b)' |
|
28 |
# match whole word |
|
29 |
repls.append((in_, out)) |
|
29 | 30 |
stream.close() |
30 | 31 |
def repl_all(str_): |
31 | 32 |
for repl, with_ in repls: str_ = re.sub(repl, with_, str_) |
Also available in: Unified diff
repl: Added support for blank lines. Only add whole word regexp code to inputs w/o any regexp metachars.