Pattern recognition for spells