# $Hg: hgkwencode.py,v$ import re, sys #re_kw = re.compile(r'[$]Hg.*?[$]') re_kw = re.compile(r'([$]Hg: .+?,v) [a-z0-9]{12} [^$]+? [$]') def kwencode(): sys.stdout.write( re_kw.sub(r'\1$', sys.stdin.read()))