URI Helper |
[eluser]Uplift[/eluser]
Is it possible to grab the uri segment after a dash. take the uri website.com/one-two-three how would i grab the segment 'three'.. or anything after the second - (dash) Thanks
[eluser]Otemu[/eluser]
An option would be to grab the whole segment one-two-three $afterSecondDash = $this->uri->segment(1); and then use a regular expression to grab all the letters after the second dash $afterSecondDash = preg_replace("insert_expression_here", $afterSecondDash ); Sadly I dont know the regular expression that will achieve this which is why I have left the text insert_expression_here, there couple of tutorials you can check out on regular expression: http://www.catswhocode.com/blog/15-php-r...developers http://webcheatsheet.com/php/regular_expressions.php http://php-regex.blogspot.com/ Hopefully that helps
[eluser]Aken[/eluser]
Grab the segment, then use explode() to separate the chunks, and end() to get the last one. |
Welcome Guest, Not a member yet? Register Sign In |