Q:

Regex for the first 3 components of URI path

Here's the URI path I need to parse:
tom-tom/sam/beta-forest%E2%84%A2/product-a
I need to extract just the first three components that end in a forward slash.
preg_match("/^([\w\/ %\.-]*){3}/", $input_line, $output_array);

This almost gets me what I want but it excludes the '%E2%84%A2'. I've been rearranging things on http://www.phpliveregex.com/ but to no avail.
Note that if I try to just parse the complete URL, say mysite.com/tom-tom/sam/beta-forest%E2%84%A2/product-a, then this regex gets me what I want:

preg_match("/^(https?://)?([\da-z.-]+).([a-z.]{2,6})([/\w
  %.-]*){3}//", $path, $output_array);

I need to parse the URI path however and I need to include the % sign. Sigh..
Edit:
My expected output is:
tom-tom/sam/beta-forest%E2%84%A2/

A:

You must need to include the start pattern to get the first three components.
preg_match("/^(?:[^\/]*\/){3}/", $input_line, $output_array);

DEMO

