RegEx for CodeIgniter Routing

Hi,

I need regex to filter certain type of urls and exclude some. The urls can be of type
(anystring)/(anystring)

I need regex to work if the first (anystring) is not one of these (cart|product|account|auth)

Ref: http://codeigniter.com/user_guide/general/routing.html
harvest-softAsked:
Who is Participating?
 
harvest-softAuthor Commented:
Ok. I think I got it
(^(?!cart|product|auth|youraccount).*)/(:any)

Ref: http://php-regex.blogspot.com/
0
 
käµfm³d 👽Commented:
Try:
$route['^(?!(?:(?:cart|product|account|auth)/))[^/]*/.*'] = ...

Open in new window

0
 
harvest-softAuthor Commented:
Nope doesn't work.
Let's simplify this. All I need is ['(:any)/(:any)'] to make sure the first (:any) is not cart|product|youraccount
0
 
harvest-softAuthor Commented:
I accepted my comment as solution because it worked! Ofcourse kaufmed helped me. He takes 500 points :)
0
 
käµfm³d 👽Commented:
Glad to have helped  = )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.