fork download
  1. import re
  2. pattern = r"\w+|[^\w \t]"
  3. text = "constructor SquareGame new(){\nlet square=square;\n}"
  4. print ( re.findall(pattern, text) )
Success #stdin #stdout 0.02s 9508KB
stdin
Standard input is empty
stdout
['constructor', 'SquareGame', 'new', '(', ')', '{', '\n', 'let', 'square', '=', 'square', ';', '\n', '}']