I am working on a node application, i need a regex to match the url pattern and get information out of the url, suggest the possible solutions.
This are the url patterns:
1) www.mysite.com/Paper/cat_CG10
2) www.mysite.com/White-Copy-Printer-Paper/cat_DP5027
3) www.mysite.com/pen/directory_pen?
4) www.mysite.com/Paper-Mate-Profile-Retractable-Ballpoint-Pens-Bold-Point-Black-Dozen/product_612884
5) www.mysite.com/22222/directory_22222?categoryId=12328
These is what is want from the above url:
1) name= "cat" value="CG10"
2) name= "cat" value="DP5027"
3) name= "directory" value ="pen"
4) name="product" value ="612884"
5) name="directory" value="22222" params = {categoryId : 12328}
I want a regex which can match the url pattern and get the values like name, value and params out of the urls.