fork download
  1. import re
  2. s= "the amount is 5/10 of the original. The #2 number should be extracted on the dd/yy"
  3. r = re.findall(r'[/#]\S+',s)
  4. print(r) # => ['/10', '#2', '/yy']
  5. print(" ".join(r)) # => /10 #2 /yy
Success #stdin #stdout 0s 23288KB
stdin
Standard input is empty
stdout
['/10', '#2', '/yy']
/10 #2 /yy