Improve tested class regex handling