• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why doesn't this regular expression get recognized by codeigniter's router

I have this route:

$route["((parameter|type|something)-([0-9]+)\/)+"] = 'somecontroller';
so when i test the url with this:


codeigniter returns with a page not found error. But I tested the regular expression here:


and it seems to work perfectly fine.

I have also tried putting the leading/trailing /'s:

$route["/((parameter|type|something)-([0-9]+)\/)+/"] = 'somecontroller';

[eluser]Tống Kiện Phi[/eluser]
you try this code

$route["((parameter|type|something)-([0-9]+))+"] = 'somecontroller';

- is a special character in regexp code. You need to escape it using \ otherwise regexp will interpret it as a spacer defining a range from
parameter OR type OR something to (range from 0 to 9 multiple times)

Maybe try a slightly simpler code
$route["(parameter\-([0-9]+))"] = 'somecontroller';
which should re-route
parameter-1, paramter-2, ... to somecontroller.
And then add further options on the first part (replace parameter with (parameter|type|something))

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.