[pcre-dev] [Bug 1203] desired features: match-and-substitute…

Pàgina inicial
Delete this message
Autor: Steve Andrews
Data:  
A: pcre-dev
Assumpte: [pcre-dev] [Bug 1203] desired features: match-and-substitute and permutations
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1203




--- Comment #5 from Steve Andrews <steven.s.andrews@???> 2012-01-27 21:08:30 ---
Hi Zoltan,

Thanks for the reply.

It's certainly true that C has poor string representation. On the other
hand, C is a sufficiently low level language that it can do anything; it's
just not necessarily easy to do it.

For item (2), you wrote:

"2) I feel the major issue here is capturin brackets. a&(b) -> a(b)|(b)a but
those capturing brackets should be the same group. Thus it surely needs
parser
modifications. And choosing & sign for this operator is somewhat strange
since
it usually means 'and'. Btw how would you define /a&b&c/ and /a&(b&c)/ ?"

Here, I think that an ampersand is both the sensible operator for this use,
and is well-defined. It's sensible because the interpretation of abc&def
is that both abc AND def must be in the string, but either order is allowed.

The pattern a&b&c should match any permutation of a, b, and c, which are
abc, acb, bca, bac, cab, and cba. Also, the pattern a&(b&c) should match
abc, acb, bca, and cba. Of course, I realize that introducing a new
operator at this point would break a lot of existing code, so I can't
envision it really happening. Nevertheless, I think that it would be a
powerful addition to the language, and one which is very much within the
current design philosophy.

-Steve


On Fri, Jan 27, 2012 at 11:54 AM, Zoltan Herczeg <hzmester@???>wrote:

> ------- You are receiving this mail because: -------
> You reported the bug.
>
> http://bugs.exim.org/show_bug.cgi?id=1203
>
> Zoltan Herczeg <hzmester@???> changed:
>
>           What    |Removed                     |Added

>
> ----------------------------------------------------------------------------
>                 CC|                            |hzmester@???

>
>
>
>
> --- Comment #4 from Zoltan Herczeg <hzmester@???> 2012-01-27 19:54:34
> ---
> Just my two cents:
>
> 1) The major problem here is that C has no string representation at all. I
> don't exactly know any portable way to do string manipulations in C.
>
> 2) I feel the major issue here is capturin brackets. a&(b) -> a(b)|(b)a but
> those capturing brackets should be the same group. Thus it surely needs
> parser
> modifications. And choosing & sign for this operator is somewhat strange
> since
> it usually means 'and'. Btw how would you define /a&b&c/ and /a&(b&c)/ ?
>
>
> --
> Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email
>



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email