Welcome Guest, Not a member yet? Register   Sign In
Need routing help, specifically with regex
#1

[eluser]ehicks727[/eluser]
Hello! I'm building a directory with entries by state, county, and city. I've got the state and county working, but need some help with the city part of it. Here's my routing.

Code:
$route['insurance/([A-Z][A-Z])/(:any)'] = 'insurance/county/$1_$2';
$route['insurance/([A-Z][A-Z])/(:any)/(:any)'] = 'insurance/city/$1_$2_$3';

I'm guessing that the first (:any) is gobbling up the second. The ([A-Z][A-Z]) represents a state code.

It should go in this order:
insurance/statecode/county
or
insurance/statecode/county/city

Is there a regex that I can use instead of :any that excludes a forward slash? The only characters allowed should be A-Z, a-z, 0-9, and a dash (-) in the county or city.

Thanks for the help. If you need me to explain my question a little better, please just ask and I'll try to clarify.


Messages In This Thread
Need routing help, specifically with regex - by El Forum - 04-15-2008, 08:21 AM
Need routing help, specifically with regex - by El Forum - 04-15-2008, 08:36 AM
Need routing help, specifically with regex - by El Forum - 04-15-2008, 08:49 AM
Need routing help, specifically with regex - by El Forum - 04-15-2008, 12:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB