in reply to Using Look-ahead and Look-behind
The following is just not working. Basically, i want to match a value that has "equity",but NOT "private equity". The result must be items 1, 2, 4, 5. Please check this out:
my %hash = ( 1 => 'equity, private equity', 2 => 'equity', 3 => 'private equity', 4 => 'private equity,equity', 5 => 'private equity, equity', 6 => 'equity,private equity', 7 => 'private equity', 8 => 'mutual funds', 9 => 'cds' ); while (my ($k, $v) = each %hash) { next unless $v =~ m/(?!private\s+)equity/; printf("%d -> %s\n", $k, $v); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using Look-ahead and Look-behind
by Anonymous Monk on Jun 25, 2011 at 08:41 UTC | |
by AnomalousMonk (Archbishop) on Jun 25, 2011 at 19:51 UTC | |
by JohnN (Initiate) on Oct 15, 2012 at 15:09 UTC | |
by choroba (Cardinal) on Oct 15, 2012 at 15:25 UTC | |
by Anonymous Monk on Oct 15, 2012 at 15:28 UTC | |
by Anonymous Monk on Jun 25, 2011 at 10:31 UTC | |
by heyjoec (Initiate) on Jun 19, 2014 at 11:18 UTC | |
by AnomalousMonk (Archbishop) on Jun 19, 2014 at 12:09 UTC | |
by Anonymous Monk on Jun 19, 2014 at 23:13 UTC |
In Section
Tutorials