Welcome Guest, Not a member yet? Register   Sign In
why doesn't this regular expression get recognized by codeigniter's router
#1

[eluser]codeigniterzzz[/eluser]
I have this route:

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

www.somewebsite.com/parameter-1/

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

http://rubular.com/

and it seems to work perfectly fine.

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

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

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

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

[eluser]PhilTem[/eluser]
- 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
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))




Theme © iAndrew 2016 - Forum software by © MyBB