GabiMe
GabiMe

Reputation: 18503

Python: Regex needed

This is probably simple, but I can't figure this out: I need regex expression which would extract following records (Each record may span multiple lines and delimited by one or more blank lines):

TextTextTextTextTextTextText

TextTextTextTextTextTextTextTextText

(one or more blank lines)

TextTextTextTextText

TextTextText

TextTextTextTextTextTextText

(one or more blank lines)

TextTextTextTextText TextTextTextTextTextTextTextTextTextText

Upvotes: 0

Views: 143

Answers (1)

Can Berk Güder
Can Berk Güder

Reputation: 113370

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

Upvotes: 4

Related Questions