am not sure what your question is or what you're really after. Could you post some example input strings and clearly indicate what part(s) you want to match?
I need a generic regex to match a fixed number of URI segments, I don't know how else to describe it.
Basically the values that make up the URI segments (ie: folders) are/can consist of arbitrary characters (length and type) but the URI segments is fixed and must match only when the number of segments matches that of the regex, make sense?
Basically I am building regex on the fly to test whether the URI of a given request matches what is expected, otherwise a 404 error would occur.
Given a URI like:
I need to match (with brackets cause if it matches I need the segments) entire URI's and then split the segments based on tokens (not nessecarily '/' only. For instance I might have a URI like:
I need:
food
apples
index
10
html
As the segments returned when I split the string, but before I do that I am verifying whether the string contains all the right segments...I suppose I could do this using an array comparison but I'd rather keep it simple with regex.
I'm try and re-ask my question:
How would I match ONLY the following URI:
Keeping in mind I need the following segments:
Not:
So splitting on the directory deliminator will not work.
What would the regex look like for a URI like:
Knowing that each segment has unknown charatcers (type and length) and the segments are:
I assume it should look something like the above?
Cheers,
Alex