http://qs321.pair.com?node_id=872404

lepetitalbert has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks

#!/usr/bin/perl use strict; use warnings; my $string = qq|<a href="/cgi-programming-with-perl.zip">cgi-programmi +ng-with-perl.zip</a>|; my $item = 'perl'; $string =~ s/(\s?[-\w\.]*(?<!\/)$item[-\w\.]*\s?)/<b>$1<\/b>/gi; print $string . "\n"; output : <a href="/<b>book-cgi-programming-with-perl.zip</b>"><b>book-cgi-progr +amming-with-perl.zip</b></a>

I'd like to match

book-cgi-programming-with-perl.zip

but not

/book-cgi-programming-with-perl.zip

I think I need a Lookbehind but after a long afternoon I have found no solution.

So any tip, hint, solution would be welcome.

Thanks !

Have a nice day

"There is only one good, namely knowledge, and only one evil, namely ignorance." Socrates