Regular Expressions 101

Community Patterns

group & access several lines

1

Regular Expression
PCRE (PHP <7.3)

/
Foo\n=+\n((.+)(?:\n-+\n))+
/
g

Description

Hi there,

I try to learn and improve my regex knowledge... I want to fetch all lines below the "="-line and between the "-"-lines and access them via $1 - $n. Is this possible? Or should I fetch the whole string below the "="-line and the last "-"-line, then seperate the lines after that in another regexp? How can I find the end then?

Thank you in advance for your help.

Submitted by Floffy - 9 years ago