?
Solved

RegEx for CodeIgniter Routing

Posted on 2011-05-04
5
Medium Priority
?
1,573 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:harvest-soft
  • 3
  • 2
5 Comments
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 2000 total points
ID: 35692714
Try:
$route['^(?!(?:(?:cart|product|account|auth)/))[^/]*/.*'] = ...

Open in new window

0
 

Author Comment

by:harvest-soft
ID: 35695704
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
 

Accepted Solution

by:
harvest-soft earned 0 total points
ID: 35695752
Ok. I think I got it
(^(?!cart|product|auth|youraccount).*)/(:any)

Ref: http://php-regex.blogspot.com/
0
 

Author Closing Comment

by:harvest-soft
ID: 36178689
I accepted my comment as solution because it worked! Ofcourse kaufmed helped me. He takes 500 points :)
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36181590
Glad to have helped  = )
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question