fork download
  1. import re
  2. s = 'let a = 5 * (other) if x is "constant";'
  3. print( re.findall(r'"[^"]*"|\w+|[^\w\s]', s) )
Success #stdin #stdout 0.03s 9460KB
stdin
Standard input is empty
stdout
['let', 'a', '=', '5', '*', '(', 'other', ')', 'if', 'x', 'is', '"constant"', ';']