if (preg_match('/^([a-z-_]++(?!\.ogg)).*$/im', $subject)) { # Successful match } else { # Match attempt failed }