Rewrite course url matcher to not be greedy

LMS-11181

Already reviewed in https://github.com/edx/edx-platform/pull/4836