The code below is using perl; but take a look at the regex to match the given string. I didn't test this a whole lot; so double check it and run a few tests to see if it does what you want.
use strict; use warnings; my $string = 'asus-eee-pc-900-+-2-gb-ram'; if ( $string =~ /\w+-\w+-\w+-\d+-\+-\w+-\w+/ ) { print "yes it matched \n"; } else { print "no match \n"; } Regards, Alfredo On Thu, Mar 5, 2009 at 3:12 PM, Alexandru Ciobanu <ics.cake...@gmail.com> wrote: > > Hi guys, > > I'm having some trouble with custom routes. > > I'm trying to match /asus-eee-pc-900-+-2-gb-ram/1521 > > My line for this in routes.php is: > Router::connect('/product-details/:slug/:id', array('controller' => > 'store', 'action' => 'view_product', 'id', 'slug'), array('id' => > '[0-9]+','slug' => '[A-Za-z0-9_\-\.\,\+]+', 'pass' => array('id', 'slug'))); > > For some reason "\+" (literal plus sign) is ignored. > > Can anyone shed some light? > > Thanks. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---