On Sat, Dec 6, 2014 at 10:11 AM, Yann Ylavic <[email protected]> wrote:
> On Sat, Dec 6, 2014 at 3:29 PM, Eric Covener <[email protected]> wrote:
>> You can call single-argument functions that returns a string, and I
>> believe that single argument is interpolated by ap_expr so it could be
>> powerful.   A function could then have its own delimeter to work
>> around the problem with args.  This is only worth discussing to save
>> the work/risk in changing the expression parser itself. The function
>> would not need to be fcgi specific, it would just be like e.g. PHP's
>> preg_replace() or somehow in an operator (that isn't =~)
>
> How about an ap_expr's function to help on this? (like Jan's
> replace(), but for regexps)
>
> Something like: extract([subject], [capture(s)], [substitution]):
> => substitute(%{PATH_INFO}, "^(.*)/strippedpathinfo(/.*)/notpathinfo", 
> "$1$2").
> so to extract all is captured by [capture(s)] and play with it (them)
> in [substitution].
>
> Or: substitute([subject], [pattern], [substitution]):
> => substitute(%{PATH_INFO}, "^(.*)/notpathinfo.*", "$1").
> so to substitue all is matched by [pattern] with [substitution].
> (hence the trailing .* is needed here).
>
> Just a matter of taste...
>
> Regards,
> Yann.


I think this is good, but needs one of a few things for places where
we want strings as the result.
 - start at "word" instead of "string" in the grammar
 - make function calls directly accessible from string
 - make multiple args in %{funcname} style calls
 - shoehorn 3 args into 1 that doesn't upset the current parser/scanner

-- 
Eric Covener
[email protected]

Reply via email to