fork(2) download
  1. import re
  2. name = 'XYZ'
  3. value = '5'
  4. content = 'XYZ.Value = 5'
  5. print(re.sub(r'(%s\.Value\s*=\s*)([^;]+)' %name, r'\g<1>' + value, content))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
XYZ.Value = 5