![]() |
help on uri routing and regular expression [solved] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: help on uri routing and regular expression [solved] (/showthread.php?tid=41509) |
help on uri routing and regular expression [solved] - El Forum - 05-10-2011 [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: help on uri routing and regular expression [solved] - El Forum - 05-10-2011 [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. help on uri routing and regular expression [solved] - El Forum - 05-10-2011 [eluser]daydreamer[/eluser] Thanks, I thought CI process it per segment so I put the $. |