URL Router for custom multi-region/language (regex)
This is an open discussion with 4 replies, filed under General.
Search
Brilliant - thank you.
As well as not putting the number ranges in the right place, I didn't realise that 2-3 characters is described as {1,2}
; I would have thought it would have been {2,3}
, which is what I interpreted this as saying. Not sure if it's a different in regex implementation or to do with the /
negation or something else. Oh well. :-)
Actually it should be {2,3}
but for some reason the [^/]
messes it up, I'm not really sure why.
Yes, [^/]
consumes one of the characters apparently.
Create an account or sign in to comment.
I'm using the URL Router and URL Segments extensions among other things for a custom approach to a multi-region and multilingual project.
Rubular permalink.
My URLs will be in the following format:
E.g.:
In the URL Router route
from
field I currently have:to
:This seems to be working fine, and I still have access to
gb
anden
(or whatever they are) via URL Segment'surl-segment-1
andurl-segment-2
parameters for data source filtering.My question is: how can I tighten up the matching of the regular expression so that the first two URL segments must be of certain length ranges (2-3 and 2-5 respectively)?
And should I be more specific than
.[^/]
(any characters except for/
)?Thanks.