|
2026-11-13
| ||
| 11:18 | • Closed ticket [2cfe14d8a4]: PostgreSQL changes to the regexp engine plus 6 o... artifact: 301c430848 user: serhiy.storchaka | |
|
2015-11-12
| ||
| 14:41 | • Ticket [d351de9d7b] Tcl lacks lookbehind in regex expressions status still O... artifact: 019c94ee32 user: dgp | |
|
2015-11-11
| ||
| 14:51 | • Ticket [d351de9d7b]: 3 changes artifact: 463bb32e4a user: tgl | |
| 10:13 | • Ticket [d351de9d7b]: 5 changes artifact: 2c239b3e60 user: dkf | |
|
2015-11-09
| ||
| 20:40 | • Ticket [d351de9d7b]: 3 changes artifact: bc23ca418d user: dgp | |
| 20:12 | • Ticket [d351de9d7b]: 3 changes artifact: dc3fc2e67f user: tgl | |
| 19:42 | • Ticket [d351de9d7b]: 3 changes artifact: 0af83f5365 user: dgp | |
|
2015-11-06
| ||
| 19:44 | • Ticket [d351de9d7b]: 3 changes artifact: b8f33e14d7 user: tgl | |
| 19:41 | • Add attachment lookbehind.patch to ticket [d351de9d7b] artifact: dfb502d79b user: tgl | |
|
2015-10-17
| ||
| 04:06 | • Ticket [d351de9d7b] Tcl lacks lookbehind in regex expressions status still O... artifact: fcfec63d54 user: tgl | |
|
2015-09-03
| ||
| 12:42 | • Ticket [d351de9d7b]: 4 changes artifact: 7ad201ee26 user: dkf | |
|
2015-09-02
| ||
| 14:08 | • Ticket [d351de9d7b]: 3 changes artifact: a5d4647dd5 user: sebres | |
| 13:20 | • Ticket [d351de9d7b]: 4 changes artifact: 97684873a8 user: dkf | |
| 11:53 | • Ticket [d351de9d7b]: 3 changes artifact: e95b5e54ed user: sebres | |
| 11:16 | • Ticket [d351de9d7b]: 3 changes artifact: 03fc91e48f user: dgp | |
|
2015-08-31
| ||
| 21:57 | • Ticket [d351de9d7b]: 4 changes artifact: b63d15d683 user: anonymous | |
| 21:15 | • Ticket [d351de9d7b]: 3 changes artifact: 4662bd1e2c user: ferrieux | |
| 08:48 | • Ticket [d351de9d7b]: 3 changes artifact: 40243a2719 user: sebres | |
|
2015-08-30
| ||
| 20:29 | • Ticket [d351de9d7b]: 6 changes artifact: 8109b896e4 user: dkf | |
|
2015-06-21
| ||
| 03:08 | • Ticket [d351de9d7b]: 4 changes artifact: 8b5107ed36 user: apnadkarni | |
|
2015-06-20
| ||
| 18:08 | • New ticket [d351de9d7b]. artifact: 5ad6e07a3f user: anonymous | |
Tcl lacks lookbehind in regex expressions
There is no notion of lookbehind in Tcl regex expressions. Only lookahead.
301c430848Closed ticket [2cfe14d8a4]: PostgreSQL changes to the regexp engine plus 6 other changes ticket2026-11-13 11:18:44
Known issue. Henry Spencer never added them to his library. (Don't know why.)
Easiest fix would be to switch to using the PCRE library, which has some advantages (e.g., it's properly maintained!) but would have quite an impact on existing users of advanced RE features. And even some not-so-advanced ones. The impact's pretty severe, in some ways.
What's about something like additionally option to use PCRE instead of "tcl" regular expressions? Something like: regexp -pc <PCRE> ... regsub -pc <PCRE> ...
Twice the maintenance effort maybe ?
I researched and I found that PCRE is used in the PHP programming language, the Apache server and R. Source: https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions I don't know whether it is a good idea to make a change . Anyway it's interesting to know what would be the increase in size, because I have understood that Tcl is normally used in embedded systems. For me the size is not so important but I imagine that for some users it is. I suppose also that with this change then the Tcl developer's team can concentrate in other important parts of the language and be more focused. What would be exact the impacts to this change? I suppose that one of them is performance, for example in alternation expressions. Source: http://lh3lh3.users.sourceforge.net/reb.shtml
See also: http://core.tcl.tk/tcl/tktview/1860727
Thx Don, is a good tip How can I download the diff.gz? It says: (file is 21230 bytes of binary data)
What would be exact the impacts to this change?The main impact is that it's a different RE language. Some scripts that currently work would cease to function as expected, despite not being necessarily broken by things (with the main portion of that impact being in the different set of backslash-escapes supported).
A necessary breakage would be something like the syntax for lookbehind becoming used for that purpose. We would not get upset over that.
> Some scripts that currently work would cease to function as expected... Not if PCRE will be not used by default, but rather optionally, like option "-pc", see my comment below.
But then you get all the complexity of a required dependency while keeping the costs associated with maintaining the old engine, and you also have to maintain the new code (which doesn't just interact with regexp and regsub, but also switch and possibly other places too).
I've put up a WIP patch for lookbehind constraints in Spencer's engine at http://www.postgresql.org/message-id/[email protected] It works, but has some performance issues. If anyone's interested in helping fix those, step right up ...
I found a solution to the performance issues I was worried about before, so attached is a proposed patch implementing lookbehind. This is equivalent to code already committed to Postgres at http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=12c9a04008870c283931d6b3b648ee21bbc2cfda
If we can do it with reasonable effort, this might go on a Tcl development branch for interested people to try out. Additions to RE syntax, though, would be an incompatibility in need of some TIP review before adding to Tcl at some well-defined release point.
FWIW, it's not an incompatibility any more than lookaheads were, because the syntax is something that will fail with an "invalid quantifier" error in a regex engine that doesn't know the feature. All of the "(?...)" features have that property, since ordinarily "?" can't follow a left paren. I don't know anything about the TIP process, so will leave that to you.
It would be a new feature, and a pretty substantial one. Tcl does such things only in .0 releases after an alpha/beta period. Would not be welcome in 8.6.5.
I'm less opposed than dgp, especially given that you're doing some burn-in testing.
Well, as far as that goes, this code won't see much public use before Postgres 9.6 is released, which is probably a year away. We don't put new features into minor releases either. So I follow dgp's concern completely: you need to absorb such things according to stated project policy. But, as a Tcl outsider, I don't want to spend much of my own time satisfying the minutiae of such policy. My feeling is "here's some code, merge when and as you see fit". (And on the third hand, if we allow the Postgres and Tcl versions of Spencer's code to diverge too far, it'll become impractical to trade even minor bug fixes. So I do have some investment in seeing you merge it eventually.)
I'm not so much opposed as just wanting it understood that a new feature will go in under different terms than bug fixes. If current visions play out, the next opportunity for new regexp features would be Tcl 9.0, and there's at least some interest in a complete overhaul to PCRE, or to a pluggable system, at that point, so remains to be seen what will happen with this work. Nevertheless, very grateful to have it, and will attempt to get it into a branch of our dev code sometime soon-ish.