multiline – Regex – Match multiple sequence of lines that contain the character pipe

I have been trying to solve this regex problem for 2 days …

I want to match values that could span multiple lines. The data must contain consecutive lines with one or more pipe characters. The idea is to convert each packet of lines to a table in Word.

See the below text sample:

dsfdqsf
dsfqds|dsfqds|qfsd|qdf
dsfqds|dsfqds|qfsd|dqsfq
dsfqds|dsfqds|qfsd|qdfvqs
dfq

dsfqds|dsfqds|qfsd|qdf
dsfqds|dsfqds|qfsd|dqsfq
dsfqdqs

Results would be the following

Match 1

dsfqds|dsfqds|qfsd|qdf
dsfqds|dsfqds|qfsd|dqsfq
dsfqds|dsfqds|qfsd|qdfvqs

Match 2

dsfqds|dsfqds|qfsd|qdf
dsfqds|dsfqds|qfsd|dqsfq

Anyone have any idea how to approach this problem?

This is only what I was able to produce :

Regex101

Read more here: Source link