<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi, i have the follwing strings: > > > /tmp/test/.test.txt > /tmp/test/hallo.txt > /tmp/test/xyz/abc.txt > /var/log/ksy/123.log > > > now i need a regex that matches all lines but the one that contains a > filename starting with a point. like ".test.txt". how can i do that? > > this is what i have: > > '\.(?!tgz)[^.]*$' this matches everything, but tgz at the end of a > line, so > > '(?!\.)[^.]*$' should do the job, but it doesnt:(....
The following will help. It first generatest the file's basename in $1 by capturing the string of all trailing characters which aren't '/', and then checks to ensure that that basename doesn't start with a dot.. HTH, Rob while (<DATA>) { chomp; if ( m<([^/]*)$> and $1 =~ /^[^.]/ ) { print $_, "\n"; } } __DATA__ /tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log OUTPUT /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]