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


in reply to match and regex

Use a zero-width negative lookahead assertion:
#!/usr/bin/perl -w use strict; foreach (<DATA>) { print "$1\n" if (m|(\w+\.bld)(?!\S*#)|) } __DATA__ ../nbssbase/ip/bld/l?ibipGH040.bld:57:# Reflecting change of eni.cxx ../nbssbase/ip/bld/l?ibipGH060.bld:60:# Reflecting change of eni.cxx ../nbssbase/ip/bld/l?ib.bld:17:eni.cxx


Cheers,
Shendal