How to match a paragraph using regex

前端 未结 5 2049
误落风尘
误落风尘 2020-12-14 13:11

I have been struggling with python regex for a while trying to match paragraphs within a text, but I haven\'t been successful. I need to obtain the start and end positions o

5条回答
  •  情书的邮戳
    2020-12-14 13:38

    Try

    ^(.+?)\n\s*\n
    

    or

    ^(.+?)\r\n\s*\r\n
    

    just do not forget append extra new line at the end of text

提交回复
热议问题