Better inline regular expression support for paths

New function supports inline regular expressions by splitting up the
path into pieces of paths and regexes. The new pathToRegex function
converts path pieces into regexes and leaves inline regexes practically
untouched.

PS: I haven't tested the new function extensively, but I'm confident it should work as intended.