fork download
  1. import re
  2. text = "#MainauDeclaration2015 watch out guys.. This is HUGE!! #LindauNobel #SemST"
  3. print( re.sub(r'#(\w+)', lambda x: '#hashtag ' + re.sub(r'(?!^)(?=[A-Z])|(?<=\D)(?=\d)|(?<=\d)(?=\D)', ' ', x.group(1)), text) )
  4. # => #hashtag Mainau Declaration 2015 watch out guys.. This is HUGE!! #hashtag Lindau Nobel #hashtag Sem S T
Success #stdin #stdout 0.03s 9592KB
stdin
Standard input is empty
stdout
#hashtag Mainau Declaration 2015 watch out guys.. This is HUGE!! #hashtag Lindau Nobel #hashtag Sem S T