Refactor menu override.

Regular expressions are too problematic and hard to maintain. Fixes #24.