in reply to Regex with lookahead
use warnings; use strict; use Data::Dump; my $re = qr{ \A \s* RepeatingGroup \s* = \s* (?<GroupID> \b[^\ \t]+\b ) \s* ( , \s* (?: (?<Flatten> \bFlatten\b ) | (?<Direction> \b(?:in|out)\b ) ) \s* ){1,2} \z }msx; dd $_, /$re/ ? \%+ : "FAIL" while <DATA>; __DATA__ RepeatingGroup = Waiver, Flatten, out RepeatingGroup = Waiver, out RepeatingGroup = Waiver, out, Flatten RepeatingGroup = Waiver , in RepeatingGroup = Waiver , Flatten
|
|---|