Problem with regex to my url route

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
Pepino483
Forum Newbie
Posts: 2
Joined: Mon Nov 09, 2009 2:26 pm

Problem with regex to my url route

Post by Pepino483 »

Hi, i problem with regex to my url route.. I have URL

,,var?" may by one or X...

var11/var12/var13/b/var21/var22/var23/t/var31/var32/var33

but url can by only

var11/var12/var13/b/var21/var22/var23/

or

var11/var12/var13/

For example.. this is URL to eshop.. For viewing products in category's and in the url is brands filter and tag filter.. I can't change the char representing filter key..

I am function solution.. Writed route for every option format of url.. Can you help me find better solution please?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Problem with regex to my url route

Post by josh »

I... dont... understand....
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Problem with regex to my url route

Post by superdezign »

Try giving us examples of your input and examples of the output from that input. Give us enough, and maybe we can determine what you are trying to do and help you mutate the input into the output.
Pepino483
Forum Newbie
Posts: 2
Joined: Mon Nov 09, 2009 2:26 pm

Re: Problem with regex to my url route

Post by Pepino483 »

oh.. i'am sorry for my bad english..

Input url may be
http://www.domain.com/shoes/sport/b/nike/asolo/t/news
or
http://www.domain.com/t-shirt/t/mens
or
http://www.domain.com/skirts/

I'am try match category as ([^bt]*) but problem come when category name is boots or anything else beginning with the letter b or t..
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Problem with regex to my url route

Post by josh »

Tell it to match a forward slash after that letter then.

For this I would really use an existing MVC framework, you wouldn't have to write regex for one.
Post Reply