fork download
  1. import re
  2.  
  3. text = ("kkkkk;\n\n"
  4. " select xx(\"xE'\", PUT(xx.xxxx.),\"'\") jdfjhf:jhfjj from xxxx_x_xx_L ;\n"
  5. "quit; \n\n"
  6. "/* 1.xxxxx FROM xxxx_x_Ex_x */ \n"
  7. "proc sql; (\"TRUuuuth\");\n"
  8. "hhhjhfjs as fdsjfsj:\n"
  9. "select * from djfkjd to jfkjs\n"
  10. "(\n"
  11. "SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj\n"
  12. " FROM &xxx..xxx_xxx_xxE\n"
  13. "where ((xxx(xx_ix as format 'xxxx-xx') gff &jfjfsj_jfjfj.) and \n"
  14. " (xxx(xx_ix as format 'xxxx-xx') lec &jgjsd_vnv.))\n"
  15. " );\n\n"
  16. "1)\n\n"
  17. "jjjjjj;\n\n"
  18. " select xx(\"xE'\", PUT(xx.xxxx.),\"'\") jdfjhf:jhfjj from xxxx_x_xx_L ;\n"
  19. "quit; \n\n"
  20. "/* 1.xxxxx FROM xxxx_x_Ex_x */ ()\n"
  21. "PROC SQL; (\"CUuuiiiiuth\");\n"
  22. "hhhjhfjs as fdsjfsj:\n"
  23. "select * from djfkjd to jfkjs\n"
  24. "(SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj\n"
  25. " FROM &xxx..xxx_xxx_xxE\n"
  26. "where ((xxx(xx_ix as format 'xxxx-xx') gff &jfjfsj_jfjfj.) and \n"
  27. " (xxx(xx_ix as format 'xxxx-xx') lec &jgjsd_vnv.))(( ))\n"
  28. " );\n\n"
  29. "2)(\n\n"
  30. "RUN;\n\n"
  31. "())\n\n"
  32. "------------\n"
  33. ")")
  34.  
  35. regex = re.compile(r'^PROC SQL;.*\n(?:(?!RUN;|QUIT;).*\n)*(?:RUN|QUIT);', re.MULTILINE | re.IGNORECASE)
  36. k = regex.findall(text)
  37. print(k)
Success #stdin #stdout 0.02s 9496KB
stdin
Standard input is empty
stdout
['proc sql; ("TRUuuuth");\nhhhjhfjs as fdsjfsj:\nselect * from djfkjd to jfkjs\n(\nSELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj\n\tFROM &xxx..xxx_xxx_xxE\nwhere ((xxx(xx_ix as format \'xxxx-xx\') gff &jfjfsj_jfjfj.) and \n      (xxx(xx_ix as format \'xxxx-xx\') lec &jgjsd_vnv.))\n );\n\n1)\n\njjjjjj;\n\n  select xx("xE\'", PUT(xx.xxxx.),"\'") jdfjhf:jhfjj from xxxx_x_xx_L ;\nquit;', 'PROC SQL; ("CUuuiiiiuth");\nhhhjhfjs as fdsjfsj:\nselect * from djfkjd to jfkjs\n(SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj\n\tFROM &xxx..xxx_xxx_xxE\nwhere ((xxx(xx_ix as format \'xxxx-xx\') gff &jfjfsj_jfjfj.) and \n      (xxx(xx_ix as format \'xxxx-xx\') lec &jgjsd_vnv.))(( ))\n );\n\n2)(\n\nRUN;']