Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^IMD(?:\+.*?){3}(?::.*?){3}(?<desc>[^:+']*)
/
gm

Description

ORDERS96B

Example of matching the line description of a ORDERS96B flatfile.

IMD+F++:::DIN 7979 D Stahl blank | 8x30 Zylin' (?<Gr0_Va0>) + (?<Gr1_Va0>) + (?<Gr2_Va0>) + (? (?<Gr3_Va0>) : (?<Gr3_Va1>) : (?<Gr3_Va2> : (?<Gr3_Va3>) ) ' Gr: Group Va: Value Description is in <Gr3_Va3>

Group/Value delimiter: [ + ] --> (?:+.?){3} Value delimiter: [ : ] --> (?::.?){3} Match ends with the next value [ : ] , next group/value [ + ] or string end mark [ ' ] --> [^:+']

Submitted by Raik Zobel - 5 years ago