OK, let's break it down bit by bit.
Here is your expression:
Code: Select all
^\/product\/([0-9]+)\/[^\/]\/([0-9]+)\/[^\/]\/([0-9]+)\/?$
http://php.net/manual/en/function.preg-match.php
First, your argument requires delimiters. Slap a / on either end and that's sorted.
Code: Select all
/^\/product\/([0-9]+)\/[^\/]\/([0-9]+)\/[^\/]\/([0-9]+)\/?$/
Now let's break this down into its constituent bits. (Note I've removed the escaping backslashes to improve readability)
^ starting at the beginning of the string
/product/ match the literal string '/product/'
([0-9]+) then match one or more digits and capture the result
[^/] match anything that is not a / once
([0-9]+) then match one or more digits and capture the result
[^/] match anything that is not a / once
([0-9]+) then match one or more digits and capture the result
/?$ end of string with an optional trailing slash.
[^/] is capturing a single character, but your URI will contain whole words, so there's a mismatch.
Your regex ends with a number and an optional trailing slash. Your URI ends with a word. Another mismatch.
Clearer?