[eluser]eggshape[/eluser]
If you write your regexp like this:
Code:
$route['item/:num'] = "item/index";
$route['example/:any'] = "example/lookup";
:num and :any will not be passed as parameters into your methods. First, :num and :any are CI's shorthand for [0-9] and (.+), which are regexp phrases that mean 'match digits' and 'match anything 1 or more'. :num and :any are replaced with their respective regexp phrases in the Route class. After replacement, CI does a preg_replace, **replacing** 'item/[0-9]' with 'item/index' in the uri string (as it is written).
So that is probably why you need to write it like this to pass as parameters:
Code:
$route['item/(:num)'] = "item/index/$1";
$route['example/(:any)'] = "example/lookup/$1";
Which is why bravoalpha's and dwdaniell's version works. When you use parentheses, you are capturing and saving everything in the parentheses. The $1 represents everything between the first set of parentheses. If you had 2 sets of (), the second one is saved as $2, and so on.
Think of it like you're inserting 'index' and 'lookup' between your original uri.
I don't think it matters where you define $route['default_controller'] and $route['scaffolding_trigger']. First $route is an associative array so there's really no order, and the default controller is used in case everything else fails.
Hope this helps.
Edit: I should add, that if the preg_replace doesn't work, then the original url is used. If that leads to nowhere you will get a 404.