Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-05 Thread Graham Leggett
On 06 Oct 2015, at 12:17 AM, Stefan Fritsch wrote: >> How about a regex function? >> >> The single argument could be “s/PATTERN/REPLACEMENT/FLAGS”. > > I think this would be easy to implement. It would require the regex to > be parsed on every execution, though, which has the disadvantages tha

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-05 Thread Stefan Fritsch
On Sunday 04 October 2015 12:51:13, Graham Leggett wrote: > On 04 Oct 2015, at 12:46 PM, Rainer Jung wrote: > > Yes, I agree. When starting to think closer, I noticed that the > > string mode currently only supports a syntax that is pretty > > different from the boolean mode and is much more limi

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-04 Thread Graham Leggett
On 04 Oct 2015, at 12:51 PM, Graham Leggett wrote: > How about a regex function? > > The single argument could be “s/PATTERN/REPLACEMENT/FLAGS”. Or more specifically: %{regex:%{REMOTE_USER} =~ /([^@]*)@.*/$1/} Or perhaps to avoid the issue of having to escape the =~ characters this: %{regex:

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-04 Thread Graham Leggett
On 04 Oct 2015, at 12:46 PM, Rainer Jung wrote: >> But it must not be too complicated. We don't want an unreadable mess >> like the sh/bash string manipulation functions. +1. > Yes, I agree. When starting to think closer, I noticed that the string mode > currently only supports a syntax that i

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-04 Thread Rainer Jung
Am 04.10.2015 um 10:23 schrieb Stefan Fritsch: On Thursday 01 October 2015 13:55:40, Rainer Jung wrote: Am 01.10.2015 um 12:31 schrieb Graham Leggett: On 01 Oct 2015, at 12:26 PM, Rainer Jung wrote: Since it gets more common to use the expression parser for string operations and not only for

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-04 Thread Stefan Fritsch
On Thursday 01 October 2015 13:55:40, Rainer Jung wrote: > Am 01.10.2015 um 12:31 schrieb Graham Leggett: > > On 01 Oct 2015, at 12:26 PM, Rainer Jung wrote: > >> Since it gets more common to use the expression parser for string > >> operations and not only for boolean checks, I think it would be

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-03 Thread Yann Ylavic
On Thu, Oct 1, 2015 at 2:44 PM, Rainer Jung wrote: > > OK, at least an encouragement for me to have a closer look. +1!

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Graham Leggett
On 01 Oct 2015, at 4:31 PM, Nick Kew wrote: >> Header set X-USER "expr=%{REMOTE_USER} =~ s/([^@]*)@.*/$1/" > > One further thought there that might be easier to work, > or a staging post on the way to your goal: > > >X-USER = $_ > # (or whatever backref syntax you prefer). > The reas

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Nick Kew
On Thu, 1 Oct 2015 15:25:38 +0200 Rainer Jung wrote: > Am 01.10.2015 um 15:03 schrieb Jim Jagielski: > > Doesn't mod_lua do this for you? > > But would it be the right tool to use whenever you want to apply a > s/.../.../? Some might say so (as some might say mod_perl or mod_rewrite). >

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Rainer Jung
Am 01.10.2015 um 15:03 schrieb Jim Jagielski: Doesn't mod_lua do this for you? But would it be the right tool to use whenever you want to apply a s/.../.../? I think the entry bar for mod_lua is higher than to get used with s/.../.../ syntax in the expression parser - though the docs for exp

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Jim Jagielski
Doesn't mod_lua do this for you? > On Oct 1, 2015, at 8:51 AM, Rainer Jung wrote: > > Am 01.10.2015 um 14:32 schrieb Nick Kew: >> On Thu, 2015-10-01 at 12:26 +0200, Rainer Jung wrote: >>> Since it gets more common to use the expression parser for string >>> operations and not only for boolean ch

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Nick Kew
On Thu, 2015-10-01 at 13:32 +0100, Nick Kew wrote: > > Header set X-USER "expr=%{REMOTE_USER} =~ s/([^@]*)@.*/$1/" > But I expect the line of least resistance would be to use > plain regexp rather than expr. Come to think of it, using regexp that looks a lot like: ${REMOTE_USER} =~ s/([^@]*)

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Rainer Jung
Am 01.10.2015 um 14:32 schrieb Nick Kew: On Thu, 2015-10-01 at 12:26 +0200, Rainer Jung wrote: Since it gets more common to use the expression parser for string operations and not only for boolean checks, I think it would be useful (and powerful) to support s/PATTERN/REPLACEMENT/FLAGS and allo

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Rainer Jung
Am 01.10.2015 um 14:33 schrieb Eric Covener: On Thu, Oct 1, 2015 at 6:26 AM, Rainer Jung wrote: Since it gets more common to use the expression parser for string operations and not only for boolean checks, I think it would be useful (and powerful) to support s/PATTERN/REPLACEMENT/FLAGS and al

AW: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Plüm , Rüdiger , Vodafone Group
> -Ursprüngliche Nachricht- > Von: Rainer Jung > Gesendet: Donnerstag, 1. Oktober 2015 13:56 > An: dev@httpd.apache.org > Betreff: Re: Expression Parser: search and replace with > s/PATTERN/REPLACEMENT/FLAGS > > > The example might be artificial and mod_head

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Eric Covener
On Thu, Oct 1, 2015 at 6:26 AM, Rainer Jung wrote: > Since it gets more common to use the expression parser for string operations > and not only for boolean checks, I think it would be useful (and powerful) > to support > > s/PATTERN/REPLACEMENT/FLAGS > > and allow back references in REPLACEMENT.

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Nick Kew
On Thu, 2015-10-01 at 12:26 +0200, Rainer Jung wrote: > Since it gets more common to use the expression parser for string > operations and not only for boolean checks, I think it would be useful > (and powerful) to support > > s/PATTERN/REPLACEMENT/FLAGS > > and allow back references in REPLACE

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Christian Folini
On Thu, Oct 01, 2015 at 01:55:40PM +0200, Rainer Jung wrote: > Something different. Example: > > Header set X-USER "expr=%{REMOTE_USER} =~ s/([^@]*)@.*/$1/" > > ... > > The example might be artificial and mod_header might support doing > this in another way, but IMHO it would be a nice general f

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Rainer Jung
Am 01.10.2015 um 12:31 schrieb Graham Leggett: On 01 Oct 2015, at 12:26 PM, Rainer Jung wrote: Since it gets more common to use the expression parser for string operations and not only for boolean checks, I think it would be useful (and powerful) to support s/PATTERN/REPLACEMENT/FLAGS and

Re: Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Graham Leggett
On 01 Oct 2015, at 12:26 PM, Rainer Jung wrote: > Since it gets more common to use the expression parser for string operations > and not only for boolean checks, I think it would be useful (and powerful) to > support > > s/PATTERN/REPLACEMENT/FLAGS > > and allow back references in REPLACEMENT

Expression Parser: search and replace with s/PATTERN/REPLACEMENT/FLAGS

2015-10-01 Thread Rainer Jung
Since it gets more common to use the expression parser for string operations and not only for boolean checks, I think it would be useful (and powerful) to support s/PATTERN/REPLACEMENT/FLAGS and allow back references in REPLACEMENT. The operation would not try to do the replacement in place b