fork download
  1. import re
  2.  
  3. regex = r"^\d+(?:\.\d+)+\. (.*(?:\r?\n(?!\d+\.).*)*)"
  4.  
  5. s = ("4.71. Firms should determine the frequency and intensity of monitoring on a risk-sensitive basis, \n"
  6. "taking into account the nature, size and complexity of their business and the level of risk to which they are exposed. \n\n"
  7. "4.72. text \n"
  8. "4.9. text\n"
  9. "4.9 addf\n"
  10. "4.73. text\n"
  11. "4.74. text ")
  12.  
  13. print(re.findall(regex, s, re.MULTILINE))
Success #stdin #stdout 0.03s 9508KB
stdin
Standard input is empty
stdout
['Firms should determine the frequency and intensity of monitoring on a risk-sensitive basis, \ntaking into account the nature, size and complexity of their business and the level of risk to which they are exposed.   \n', ' text ', 'text', ' text', ' text ']