Check equality instead of regex

Thanks, @Meatballs1 for finding the cause of this bug!

[FixRM #8149]