Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: users

regex simple replace help

 

 

Cherokee users RSS feed   Index | Next | Previous | View Threaded


bjesus at gmail

Oct 29, 2009, 6:56 AM

Post #1 of 4 (71 views)
Permalink
regex simple replace help

Hey,
I'm trying to use regex for a simple redirection without succces. Only wants
to redirect '/dir/another/path/to/file.ext' into
'/dir/newone/another/path/to/file.ext'.
This is what I wrote:
^/dir\/another/(.*)$ -> /dir/newone/another/$1

Am I close?.. :p

Currently I'm getting internal server error.

Thank you!

--
Yo'av Moshe


xiong.chiamiov at gmail

Nov 4, 2009, 9:58 AM

Post #2 of 4 (52 views)
Permalink
Re: regex simple replace help [In reply to]

On Thu, Oct 29, 2009 at 5:56 AM, Yo'av Moshe <bjesus[at]gmail.com> wrote:

> Hey,
> I'm trying to use regex for a simple redirection without succces. Only
> wants to redirect '/dir/another/path/to/file.ext' into
> '/dir/newone/another/path/to/file.ext'.
> This is what I wrote:
> ^/dir\/another/(.*)$ -> /dir/newone/another/$1
>

Why are you only escaping one of the backslashes? In fact, since you're not
doing an s/// syntax, shouldn't that one not need to be escaped at all?

--
James Pearson
--
The best way to predict the future is to invent it.
- Alan Kay


bjesus at gmail

Nov 4, 2009, 11:42 AM

Post #3 of 4 (52 views)
Permalink
Re: regex simple replace help [In reply to]

Well, I removed that slash and I still get 500 Internal Server Error.

Now my regex is '^/dir/another/(.*)$'.
Is there any simpler way to to this redirection?

What's the s/// syntax?

Yo'av

2009/11/4 James Pearson <xiong.chiamiov[at]gmail.com>

> On Thu, Oct 29, 2009 at 5:56 AM, Yo'av Moshe <bjesus[at]gmail.com> wrote:
>
>> Hey,
>> I'm trying to use regex for a simple redirection without succces. Only
>> wants to redirect '/dir/another/path/to/file.ext' into
>> '/dir/newone/another/path/to/file.ext'.
>> This is what I wrote:
>> ^/dir\/another/(.*)$ -> /dir/newone/another/$1
>>
>
> Why are you only escaping one of the backslashes? In fact, since you're
> not doing an s/// syntax, shouldn't that one not need to be escaped at all?
>
> --
> James Pearson
> --
> The best way to predict the future is to invent it.
> - Alan Kay
>


--
Yo'av Moshe


xiong.chiamiov at gmail

Nov 4, 2009, 1:55 PM

Post #4 of 4 (51 views)
Permalink
Re: regex simple replace help [In reply to]

On Wed, Nov 4, 2009 at 11:42 AM, Yo'av Moshe <bjesus[at]gmail.com> wrote:

> Well, I removed that slash and I still get 500 Internal Server Error.
>
> Now my regex is '^/dir/another/(.*)$'.
> Is there any simpler way to to this redirection?
>
> What's the s/// syntax?
>

It's how you perform regex search-and-replace in perl, vim, a few irc bots I
know of, and I'm sure much more. s/foo/bar/ would replace all instances of
foo with bar. Backslashes have to be escaped when doing this, since they
are used to delimit the terms.

I'm not sure exactly how Cherokee handles regexp, though, so I can't say
anything about its behavior in regard to those kind of special cases.

What do you see in the logs?

--
James Pearson
--
The best way to predict the future is to invent it.
- Alan Kay

Cherokee users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.