Welcome Guest, Not a member yet? Register   Sign In
help with routes[]
#1

[eluser]chefnelone[/eluser]
Hello

I have this route rule working fine:

Code:
$route['[^/]+/(:any)'] = 'index/$1';

it re-maps these URL strings:
en/photos
es/contact
cat/contact


but my problem is that it re-maps these too:
something/photos
somethingelse/contact


I need to limit the rule to work only if the first segment have 2 o 3 characters.
I know I have to put {2,3} somewhere but don't know where....

thanks
#2

[eluser]Jelmer[/eluser]
{2,3} goes where the + sign goes now, the + sign essentially means {1,} (1 or more).

So you get:
Code:
$route['[^/]{2,3}/(:any)'] = 'index/$1';
#3

[eluser]chefnelone[/eluser]
[quote author="Jelmer" date="1284561251"]{2,3} goes where the + sign goes now, the + sign essentially means {1,} (1 or more).

So you get:
Code:
$route['[^/]{2,3}/(:any)'] = 'index/$1';
[/quote]

thanks jelmer




Theme © iAndrew 2016 - Forum software by © MyBB