http://www.perlmonks.org?node_id=1090446


in reply to Re^3: Using Look-ahead and Look-behind
in thread Using Look-ahead and Look-behind

How about just (untested, and also case-sensitive):

sub TestEquity { return $_[0] =~ m/private.*equity/ ? 0 : $_[0] =~ m/equity/ ? 1 : 0 ; }
This could be slightly simplified if you can tolerate  "" (empty string) as a false flag in addition to or in place of 0.

BTW: "I can't get it to work" is rarely helpful as a problem description. How about some input strings and actual versus expected output?

Update: Changed  $_[0] =~ m/private.*equity/ to  $_[0] =~ m/private/ because it makes more sense.
Update: ... and then changed it back to  $_[0] =~ m/private.*equity/ because it actually makes even more sense that way! (sigh)