1120431: Support for complex path matching.

RHUI is using this code server side. It was having issues matching paths such as
/one/$release/two
/one/three/four

with the strings

/one/three/two

The issue was that the old algorithm would look at the second node, match the three, and
not use the wildcard of the $release. The new alogithm fixes this.