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


in reply to Re^3: Find Prefix if regex didn't match
in thread Find Prefix if regex didn't match

aah now I got your idea, not bad but that's too much simplified ;)

Extracting a \w+ prefix from the expression e.g. doesn't work with stuff like this:
my $search="(AB)+.*Z";

The problem is that the search string is given and therefore I have no influence on it. Maybe you have been irritated by my ".*ABC" example but what I ment here was that in such a case there is no unmatchable prefix that can be cut away.