#!/usr/bin/perl # http://perlmonks.org/?node_id=1196747 use strict; use warnings; use Data::Dump 'pp'; while(<DATA>) { /RepeatingGroup\s*=\s* (?<GroupID>\b\S+\b)\s* (?=.*(?<Flatten>\bFlatten\b))? (?=.*(?<Direction>\b(in|out)\b))? /x or next; print; pp \%+; } __DATA__ RepeatingGroup = Waiver, Flatten, out RepeatingGroup = Waiver, out RepeatingGroup = Waiver, out, Flatten RepeatingGroup = Waiver , in RepeatingGroup = Waiver , Flatten
In reply to Re: Regex with lookahead
by tybalt89
in thread Regex with lookahead
by ericwsf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |