in reply to Negative Lookahead Assertion Problem

Since your question as to why it doesn't work has been answered. (Basically it will backtrack till it does, and by moving a character back satisfies the regex.)

This should work:/\w+::(?>\w+)(?!\s*\()/

#!/usr/bin/perl use strict; use warnings; my @strings = ( '1. Foo::Bar', '2. Foo::Bar(', '3. Foo::Bar (', '4. Foo::Bar ' ); for ( @strings ) { print $_,$/ if /\w+::(?>\w+)(?!\s*\()/; } __END__ 1. Foo::Bar 4. Foo::Bar
Have a look at perlre where it reads about (?>pattern)