0

What Regex can I use that includes ONLY the first option below, excluding the other two?

  1. www.site.com/products/category_name
  2. www.site.com/products/category_name/
  3. www.site.com/products/category_name/product_name

I've tried ^www.site.com/products/(.*)[^/]$ but it also takes the last option as valid.

On the other hand, what Regex can I use to include the first URL below and exclude the second one with parameters?

  1. www.example.com/en-gb/category/example-of-product
  2. www.example.com/en-gb/category/example-of-product tduid=5758f21169858a7e15da57791c070f0d

Many thanks!

  • The first one can be fixed as `^www\.site\.com\/products\/([^\/]*)$`. As for the second, what have you tried? – Wiktor Stribiżew Apr 24 '18 at 19:09
  • For 1. try: `^www\.site\.com\/products\/category_name$` For 2. try: `^www.example.com\/en-gb\/category\/example-of-product$` – Matt.G Apr 24 '18 at 19:35

0 Answers0