fork download
  1. import re
  2.  
  3. def extract_all_after_string(search_after, reg, text):
  4. start = text.find(search_after)
  5. if start >= 0:
  6. print(f"Found at {start}, looking from {start+len(search_after)}, i.e. in '{text[start+len(search_after):]}'")
  7. return reg.findall(text, start+len(search_after))
  8. return []
  9.  
  10. text = "we have a Newliner Chatacter in 10000 the Middle of the sentence"
  11. search_after = "a "
  12. reg = re.compile(r'\w+')
  13. print(extract_all_after_string(search_after, reg, text))
Success #stdin #stdout 0.04s 9300KB
stdin
Standard input is empty
stdout
Found at 8, looking from 10, i.e. in 'Newliner Chatacter in 10000 the Middle of the sentence'
['Newliner', 'Chatacter', 'in', '10000', 'the', 'Middle', 'of', 'the', 'sentence']