Routes regular expression - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Routes regular expression (/showthread.php?tid=25889) |
Routes regular expression - El Forum - 12-29-2009 [eluser]cinoob[/eluser] I'm looking to use the routes config to rewrite a url. I have managed to get this working as follows: Code: $route['events/([A-Za-z+]+)/(\d+)'] = "events/details/$1"; This allows me to use a url with the event name in it rather than the function details. The problem is that there are other functions in this controller that I want to use - eg. /events/index Also this will work fine as the structure does not match the regular expression, however, if I use pagination on this page it does match the regular expression ie: events/index/10. How can I change the regular expression to exclude index or any number of selected functions? Routes regular expression - El Forum - 12-29-2009 [eluser]cinoob[/eluser] I've managed to get it to work with Code: $route['events/(?!index)([A-Za-z+]+)/(\d+)'] = "events/details/$1"; Should be fine for just about everything I need but this will still match an event with a name beginning with index. Does anyone know how to exclude all instances of index including the beginning of the string? |