Don't use shorthand match on routes with inappropriate symbols

Fixes exception from #18211
Test in this pull-request shows an example.
This changes the existing behaviour for non-dynamic paths:

``` ruby
>> "foo/bar".match(%r{/[\w/]+$})
=> #<MatchData "/bar">
>> "foo/bar".match(%r{^[\w-]*/[\w/-]+$})
=> #<MatchData "foo/bar">
```