my @list = ('file.aspx',
'Account/otherfile.aspx',
'Public/otherfile.aspx',
'otherfolder1/otherfile.aspx?stuff=otherstuff',
'otherfolder2/otherfolder/otherfile.aspx',
'otherfolder3/',
'otherfolder4');
foreach (@list) {
print "$1\n" if /^(?!Account|Public)([^\.\/]+(?:\/[^\?]*|[^\.\?]*))$/; }
bXkgQGxpc3QgPSAoJ2ZpbGUuYXNweCcsIAogICAgICAgICAgICAnQWNjb3VudC9vdGhlcmZpbGUuYXNweCcsIAogICAgICAgICAgICAnUHVibGljL290aGVyZmlsZS5hc3B4JywgCiAgICAgICAgICAgICdvdGhlcmZvbGRlcjEvb3RoZXJmaWxlLmFzcHg/c3R1ZmY9b3RoZXJzdHVmZicsIAogICAgICAgICAgICAnb3RoZXJmb2xkZXIyL290aGVyZm9sZGVyL290aGVyZmlsZS5hc3B4JywgCiAgICAgICAgICAgICdvdGhlcmZvbGRlcjMvJywgCiAgICAgICAgICAgICdvdGhlcmZvbGRlcjQnKTsKIApmb3JlYWNoIChAbGlzdCkgewogIHByaW50ICIkMVxuIiBpZiAvXig/IUFjY291bnR8UHVibGljKShbXlwuXC9dKyg/OlwvW15cP10qfFteXC5cP10qKSkkLzsKfQo=