Don't use shorthand match on routes with inappropriate symbols

Fixes exception from #18211
Test in this pull-request shows an example.
This regexp is used only as a filter (whether we use shorthand matching or not). Therefore `foo/bar` would be picked for matching in both cases.

A different regexp is used to pick an action name.