Python:正则表达式需要

时间:2009-12-25 15:08:31

标签: python regex

这可能很简单,但我无法弄明白: 我需要正则表达式,它将提取以下记录(每条记录可能跨越多行并由一个或多个空行分隔):

TextTextTextTextTextTextText

TextTextTextTextTextTextTextTextText

(一个或多个空白行)

TextTextTextTextText

TextTextText

TextTextTextTextTextTextText

(一个或多个空白行)

TextTextTextTextText TextTextTextTextTextTextTextTextTextText

1 个答案:

答案 0 :(得分:4)

import re
re.split('\n\n+', text)