Take a given URI, like this:
one/two/three
How would I match each character, in a capture group, between the slashes? This can be done with this method:
(.+)\/(.+)\/(.+)
This gives me three groups where:
$1 = one
$2 = two
$3 = three
What I am having trouble with is making a capture group optional. I thought that this would work, thinking I could make each group optional (match zero or more):
(.+)?\/(.+)?\/(.+)?
Is there a way, using Regex or PHP to optionally match parts one, two or three of the above URI?