Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-29 Thread Jakub Wilk
* Guido van Rossum , 2017-10-28, 14:05: even if we outright switched there would *still* be two versions, because regex itself has an internal versioning scheme where V0 claims to be strictly compatible with re and V1 explicitly changes the matching rules in some cases. (I

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-29 Thread MRAB
On 2017-10-29 12:27, Serhiy Storchaka wrote: 27.10.17 18:35, Guido van Rossum пише: The "why" question is not very interesting -- it probably wasn't in PCRE and nobody was familiar with it when we moved off PCRE (maybe it wasn't even in Perl at the time -- it was ~15 years ago). I didn't

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-29 Thread Serhiy Storchaka
27.10.17 18:35, Guido van Rossum пише: The "why" question is not very interesting -- it probably wasn't in PCRE and nobody was familiar with it when we moved off PCRE (maybe it wasn't even in Perl at the time -- it was ~15 years ago). I didn't understand your description of \G so I googled it

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-29 Thread Greg Ewing
Guido van Rossum wrote: From this I understand that when using e.g. findall() it forces successive matches to be adjacent. Seems to me this would be better addressed using an option to findall() rather than being part of the regex. That would avoid the issue of where to keep the state. --

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-28 Thread Nick Coghlan
On 29 October 2017 at 09:31, MRAB wrote: > On 2017-10-28 22:05, Guido van Rossum wrote: > >> I don't condone having two different regex implementations/APIs bundled >> in any form, even if one were to be deprecated -- we'd never get rid of the >> deprecated one until

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-28 Thread MRAB
On 2017-10-29 00:48, Steven D'Aprano wrote: On Sun, Oct 29, 2017 at 12:31:01AM +0100, MRAB wrote: Not that I'm planning on making any further additions, just bug fixes and updates to follow the Unicode updates. I think I've crammed enough into it already. There's only so much you can do with

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-28 Thread Peter Ludemann via Python-Dev
On 28 October 2017 at 16:48, Steven D'Aprano wrote: > On Sun, Oct 29, 2017 at 12:31:01AM +0100, MRAB wrote: > > > Not that I'm planning on making any further additions, just bug fixes > > and updates to follow the Unicode updates. I think I've crammed enough > > into it

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-28 Thread Steven D'Aprano
On Sun, Oct 29, 2017 at 12:31:01AM +0100, MRAB wrote: > Not that I'm planning on making any further additions, just bug fixes > and updates to follow the Unicode updates. I think I've crammed enough > into it already. There's only so much you can do with the regex syntax > with its handful of

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-28 Thread MRAB
On 2017-10-28 22:05, Guido van Rossum wrote: On Sat, Oct 28, 2017 at 12:09 AM, Nick Coghlan > wrote: On 28 October 2017 at 01:57, Guido van Rossum > wrote: Oh. Yes, that is being

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-28 Thread Guido van Rossum
On Sat, Oct 28, 2017 at 12:09 AM, Nick Coghlan wrote: > On 28 October 2017 at 01:57, Guido van Rossum wrote: > >> Oh. Yes, that is being discussed about once a year two. It seems Matthew >> isn't very interested in helping out with the port, and there are

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-28 Thread Nick Coghlan
On 28 October 2017 at 01:57, Guido van Rossum wrote: > Oh. Yes, that is being discussed about once a year two. It seems Matthew > isn't very interested in helping out with the port, and there are some > concerns about backwards compatibility with the `re` module. I think it >

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-27 Thread Jakub Wilk
* Guido van Rossum , 2017-10-27, 08:35: The "why" question is not very interesting -- it probably wasn't in PCRE and nobody was familiar with it when we moved off PCRE (maybe it wasn't even in Perl at the time -- it was ~15 years ago). Perl supports \G since v5.0, released

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-27 Thread Ed Peschko
> From this I understand that when using e.g. findall() it forces successive > matches to be adjacent. yes, I admit that this is a clearer description of what \G does. My only defense is that I wrote my description when it was late. :) I can only stress how useful it is, especially for

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-27 Thread Guido van Rossum
Oh. Yes, that is being discussed about once a year two. It seems Matthew isn't very interested in helping out with the port, and there are some concerns about backwards compatibility with the `re` module. I think it needs a champion! On Fri, Oct 27, 2017 at 8:50 AM, Tim Peters

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-27 Thread Tim Peters
Note that Matthew Barnett's `regex` module already supports \G, and a great many other features that weren't around 15 years ago ;-) either: https://pypi.python.org/pypi/regex/ I haven't followed this in detail. I'm just surprised once per year that it hasn't been folded into the core ;-)

Re: [Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-27 Thread Guido van Rossum
The "why" question is not very interesting -- it probably wasn't in PCRE and nobody was familiar with it when we moved off PCRE (maybe it wasn't even in Perl at the time -- it was ~15 years ago). I didn't understand your description of \G so I googled it and found a helpful StackOverflow article:

[Python-Dev] \G (match last position) regex operator non-existant in python?

2017-10-27 Thread Ed Peschko
All, perl has a regex assertion (\G) that allows multiple-match regular expressions to be able to use the position of the last match. Perl's documentation puts it this way: \G Match only at pos() (e.g. at the end-of-match position of prior m//g) Anyways, this is exceedingly powerful for