Fixes #1: explicit ordering for device categories when applying regexps