Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,
i want a Regular Expression that matches:-

Product/banana/WUCMH4IJ

where banana is product name and WUCMH4IJ is id for banana

please help me.

thanks in advance
Posted
Updated 21-Jan-15 19:32pm
v2
Comments
Sergey Alexandrovich Kryukov 22-Jan-15 2:51am    
"Product/banana/WUCMH4IJ" matches one and only one string: "Product/banana/WUCMH4IJ".
Are you getting the hint? one example is not definition. If you need help, you should have defined the rule you want to implement.
—SA

1 solution

Hi,

if you can give 3 or 4 full url sample for better understanding of your requirement, it will be helpful.

we can use "substring" + "indexOf" for your requirement.

By the way you can learn more about Regular Expression here. I hope it will useful for you.

https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions[^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900