Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^LIN[\s\S]*?(?=^LIN.*?)|^LIN[\s\S]*
/
gm

Description

^LIN[\s\S]?(?=^LIN.?)|^LIN[\s\S]*

FIRST PART From the first line string of an item line --> ^LIN over line breaks --> [\s\S]? to before (lookahead) the next line element --> (?=^LIN.?)

OR

SECOND PART From the first line string of an item line --> ^LIN over line breaks to the end of the string --> [\s\S]*

The first part matches all line elements, except the last line element. The last Line Element ist matched by the second part.

Submitted by Raik Zobel - 5 years ago