use regexps for command matching (a bit slower, but easier)