[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fixing ill-conditioned regular expressions. Proof of concept.
From: |
Tassilo Horn |
Subject: |
Re: Fixing ill-conditioned regular expressions. Proof of concept. |
Date: |
Thu, 26 Feb 2015 12:05:37 +0100 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |
Alan Mackenzie <address@hidden> writes:
Hi Alan,
>> Sure, but you could remember how the \(...\) constructs were
>> renumbered, and fix the match data after the underlying regexp call
>> returned. It shouldn't be a big deal.
>
> Unfortunately, it's not that simple. Consider the RE
>
> \(R\)+E*\(R\)+
> 1 1 2 2
>
> . This gets transformed to
>
> \(R\)+\(?:E+\(R\)+\|\(R\)\)
> 1 1 2 2 2 2
>
> . What was subexpression 2 in the original has become two
> subexpressions straddling an \| sign in the transformation. I don't
> think there's a way of transforming R+E*R+ that preserves the
> numbering of the subexpressions.
Couldn't you use explicitly numbered groups, i.e., the regex would
translate to
\(?1:R\)+\(?:E+\(?2:R\)+\|\(?2:R\)\)
?
As long as the groups with the same number are exclusive there shouldn't
be a problem.
Bye,
Tassilo
- Re: Fixing ill-conditioned regular expressions. Proof of concept., (continued)
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Paul Eggert, 2015/02/23
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Alan Mackenzie, 2015/02/23
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Paul Eggert, 2015/02/23
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Alan Mackenzie, 2015/02/23
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Artur Malabarba, 2015/02/23
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Paul Eggert, 2015/02/23
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Alan Mackenzie, 2015/02/25
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Stephen J. Turnbull, 2015/02/25
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Paul Eggert, 2015/02/26
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Alan Mackenzie, 2015/02/26
- Re: Fixing ill-conditioned regular expressions. Proof of concept.,
Tassilo Horn <=
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Alan Mackenzie, 2015/02/26
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Stefan Monnier, 2015/02/26
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Alan Mackenzie, 2015/02/26
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Stefan Monnier, 2015/02/26
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Alan Mackenzie, 2015/02/26
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Stefan Monnier, 2015/02/27
- Re: Fixing ill-conditioned regular expressions. Proof of concept., Stefan Monnier, 2015/02/24
Re: Fixing ill-conditioned regular expressions. Proof of concept., Philipp Stephani, 2015/02/24