...regardless of the modifier using Perl? I have used the regexp which doesn't match well ( i.e., matches commented code as well):

if(($token =~ m/(public|protected|private|abstract|static|strictfp )?[\s\n]+class[\s\n]+([A-Z][\w_\$]*)[\s\n]+(implements[\s\n]+\w+([\s\n]*\,[\s\n]*\w+[\s\n]*)*)?/) or ($token =~ m/^(class)[\s\n]+([A-Z][\w_\$]*)[\s\n]+(implements[\s\n]+\w+([\s\n]*\,[\s\n]*\w+[\s\n]*)*)?/) and ($token !~ m/extends/))
{

PS: My file delimiter is the open curly braces.

I'll appreciate any help. Thanks
Thanks. But Im thinking that method would give me subclasses as well.