help on uri routing and regular expression [solved] |
[eluser]daydreamer[/eluser]
I have these routes: Code: $route['product/.*id([0-9]+$)/status']='product/index/status/$1'; I cannot get the first route to work. The second route worked for uri: "/product/product_name id234" The first route doesn't work and fall to third route: "/product/product_name id234/status" Please give some hints. Thanks. ------------- Removed the "$" in the route work, but don't understand why. It's hard to play with regular expression :long:
[eluser]bubbafoley[/eluser]
'$' means the end of the string in regex which is why the first route fails. http://www.regular-expressions.info/reference.html: Quote:Matches at the end of the string the regex pattern is applied to. Matches a position rather than a character. Most regex flavors have an option to make the dollar match before line breaks (i.e. at the end of a line in a file) as well. Also matches before the very last line break if the string ends with a line break.
[eluser]daydreamer[/eluser]
Thanks, I thought CI process it per segment so I put the $. |
Welcome Guest, Not a member yet? Register Sign In |