javascript-route-matcher icon indicating copy to clipboard operation
javascript-route-matcher copied to clipboard

Support for Full URL and Wildcards

Open drveresh opened this issue 7 years ago • 1 comments

Hi,

This seems to work only with relative URLs. Can you please extend the functionality to support full-length URLs as well? We need the solution for below use cases:

1. Sub-string match Input URL: www.amazo.com/xyz/dp/B00UIIDP06/ref=sr_1_1_sspa?s=photo Matcher: routeMatcher("/dp/:asin/:extra"); Results: null, it doesn't work because it is expecting the input as "dp/B00UIIDP06/ref=sr_1_1_sspa.." Ideal Case: It should just check the pattern exist in give full-length URL. If it is expected, then we need to manually extract the relative URL then feed to this.

2. Forced expression Input URL: www.amazo.com/xyz/dp/B00UIIDP06/ref=sr_1_1_sspa?s=photo Matcher: routeMatcher("/dp/:asin/"); Results: null, it doesn't work because it is expecting to cover even beyond "/B00UIIDP06/", for "/ref=sr_1_1_sspa?s=photo" Ideal Case: There is no need to check beyond what is required(/dp/:asin/). In case, if there are multiple params/sections like "/abc/edf/zya/ref=sr_1_1_sspa?blah..", then we should extend the expression to really long

3. How to cover before/after from the matching point, like Wildcards? Similar to https://www.npmjs.com/package/route-pattern?

Input URL: www.amazo.com/xyz/dp/B00UIIDP06/ref=sr_1_1_sspa?s=photo Matcher(expected): routeMatcher("[*before]dp/:asin/[*after]"); Ideal Case: It is useful to know before/after URL parts when a given pattern is matched

Thanks and appreciating your support!

drveresh avatar Dec 08 '18 07:12 drveresh

@cowboy Any updates on this?

I am eagerly waiting for these features and there too many use cases depend on URL sub-string matching.

drveresh avatar Mar 19 '19 02:03 drveresh