fork(1) download
  1. import re
  2. s = '{qcos\\theta_{g}\\over r})^{2\\over 1 + \\alpha^{2}}}\\ 1234'
  3. print( ' '.join(re.findall(r'\\[a-zA-Z]*|\S', s)) )
  4. #Expect: { q c o s \theta _ { g } \over r } ) ^ { 2 \over 1 + \alpha ^ { 2 } } } \ 1 2 3 4'
  5. #Obtained:{ q c o s \theta _ { g } \over r } ) ^ { 2 \over 1 + \alpha ^ { 2 } } } \ 1 2 3 4
Success #stdin #stdout 0.02s 9596KB
stdin
Standard input is empty
stdout
{ q c o s \theta _ { g } \over r } ) ^ { 2 \over 1 + \alpha ^ { 2 } } } \ 1 2 3 4