path-to-regexp
path-to-regexp copied to clipboard
How would I match a path disregarding the query?
I want to rewrite a path starting with /some/path whether or not it has a trailing slash (or a sub route), and ignores the query, simply copying it to the new path unchanged.
/some/path --> /other/path
/some/path/ --> /other/path/
/some/path?a=b --> /other/path?a=b
/some/path/?a=b --> /other/path/?a=b
/some/path/sub --> /other/path/sub
/some/path/sub/ --> /other/path/sub/
/some/path/sub?a=b --> /other/path/sub?a=b
/some/path/sub/?a=b --> /other/path/sub/?a=b
I haven't been able to figure out how to do this with path-to-regexp.