[thelist] Regex Riddle

Frank Marion lists at frankmarion.com
Sun Aug 29 08:08:24 CDT 2010


On 2010-08-29, at 8:38 AM, Bill Moseley wrote:
> But maybe you know the order of the parameters so can convert to a  
> path by
> some table lookup.  That is, you know the hierarchy so if you see a  
> URL:
>
> http://example.com/index.cfm?type=polar&page=3&section=animal&class=bear
>
> You would know to rewrite it as:
>
> http://example.com/animal/bear/polar?page=3


Yeah, I broke down and did the whole job via a series of search and  
replaces. /me shrugs. Not as elegant as I would have liked, but it's  
fast, solid and trouble free.

On to my next puzzle: Does anyone have an idea how to mask the index  
file from a url?

Currently I have something like

http://www.example.com/index.cfm/section/1/article/2

I'd like to reduce it to

http://www.example.com/section/1/article/2

and eventually, when I've got the code ready, I'll be doing

http://www.example.com/this-is-a-great-article

--
Frank Marion
lists [_at_] frankmarion.com








More information about the thelist mailing list