fork(1) download
  1. import re
  2.  
  3. def repl(m):
  4. return m.group(1) + "time" + m.group(3)
  5.  
  6. a = [' /abc/def/zx -a 12 -b 12 -c 14 -d 15 --pqr -A $done1 ', 'abc','def']
  7. for index, x in enumerate(a):
  8. a[index] = re.sub('(.*zx )(.*)( -A \$done1)', repl, x)
  9.  
  10. print(a)
Success #stdin #stdout 0s 23296KB
stdin
Standard input is empty
stdout
['  /abc/def/zx time -A $done1  ', 'abc', 'def']