fork(2) download
  1. import re
  2.  
  3. def less10(string):
  4. return int(string) - 10
  5.  
  6. def replacer(match):
  7. return '%s%d,%d%s' % (match.group('prefix'),
  8. less10(match.group('x')),
  9. less10(match.group('y')),
  10. match.group('suffix'))
  11.  
  12. print re.sub(r'(?P<prefix><stuff[^>]*translate\()(?P<x>\d*),(?P<y>\d*)(?P<suffix>\)/>)',
  13. replacer,
  14. '<stuff translate(100,200)/>')
  15.  
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
<stuff translate(90,190)/>