fork download
  1. import re
  2. regex = r"^(?!\d+\s*$)\d+.+$"
  3. test_str = ("Here goes some text. {tag} A wonderful day. It's soon cristmas.\n"
  4. "2 Happy 2019, soon. {Some useful tag!} Something else goes here.\n"
  5. "3 Happy ending. Yeppe! See you.\n"
  6. "4\n"
  7. "5 Happy KKK!\n"
  8. "6 Happy B-Day!\n"
  9. "7\n"
  10. "8 Universe is cool!\n"
  11. "9\n"
  12. "10 {Tagish}.\n"
  13. "11\n"
  14. "12 {Slugish}. Here goes another line. {Slugish} since this is a new sentence.\n"
  15. "13\n"
  16. "14 endline.")
  17. print(re.findall(regex, test_str, re.MULTILINE));
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
['2 Happy 2019, soon. {Some useful tag!} Something else goes here.', '3 Happy ending. Yeppe! See you.', '5 Happy KKK!', '6 Happy B-Day!', '8 Universe is cool!', '10 {Tagish}.', '12 {Slugish}. Here goes another line. {Slugish} since this is a new sentence.', '14 endline.']