Don't use shorthand match on routes with inappropriate symbols

Fixes exception from #18211
Test in this pull-request shows an example.