Welcome Guest, Not a member yet? Register   Sign In
Route regular expression should not match according to regexpal.com, but it does anyway
#1

[eluser]hal10001[/eluser]
Code:
^([a-zA-Z-]+/)*[a-zA-Z-]+/?$

That should match the following:

category-name/sub-category-name/sub-sub-category-name/page-name

However, it should NOT match:

category-name/sub-category-name//sub-sub-category-name/page-name

Notice the double slash. The route is as follows:

Code:
$route['^([a-zA-Z-]+/)*[a-zA-Z-]+/?$'] = "homepage";

Right now I'm just redirecting to the homepage for testing purposes. When it doesn't match, it should throw a 404. So on a URL with a double slash it should be throwing a 404.


Messages In This Thread
Route regular expression should not match according to regexpal.com, but it does anyway - by El Forum - 02-11-2009, 09:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB