Check validity of instance name before matching prefix