Fixed preg_match in app detection function