Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. for reg, repl in ABRVS:
  2.     match_object = reg.search(v)
  3.     if match_object:
  4.         match = match_object.group()
  5.         if v.endswith(match):
  6.             strip_end_period = False
  7.         if isinstance(repl, basestring):
  8.             sub = repl
  9.         else:
  10.             sub = repl(match_object)
  11.         start = v.find(match)
  12.         while start >= 0:
  13.             stop = start + len(match)
  14.             patches.append((sub, start, stop))
  15.             v = v.replace(match, '*' * len(match), 1)
  16.             start = v.find(match)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement