Re: Some regular-expression performance hacking
Tom Lane <tgl@sss.pgh.pa.us>
Chapman Flack <chap@anastigmatix.net> writes: > On 02/19/21 10:26, Tom Lane wrote: >> Oooh, that's very interesting. I guess the advantage of that over using >> the 's' flag is that you can have different behaviors at different places >> in the same regex. > Perl, Python, and Java (at least) all have a common syntax for changing > flags locally in a non-capturing group, so you could just match (?s:.) > -- which I guess isn't any shorter than [\w\W] but makes the intent more > clear. Hmm, interesting. > I see that JavaScript, for some reason, does not advertise that. We don't > either; we have (?:groups) without flags, and we have (?flags) but only > global at the start of the regex. Would it be worthwhile to jump on the > bandwagon and support local flags in groups? Yeah, perhaps. Not sure whether there are any built-in assumptions about these flags holding still throughout the regex; that'd require some review. But it seems like it could be a useful feature, and I don't see any argument why we shouldn't have it. regards, tom lane
Commits
-
Suppress unnecessary regex subre nodes in a couple more cases.
- 4604f83fdfe0 14.0 landed
-
Improve memory management in regex compiler.
- 0fc1af174cf7 14.0 landed
-
Extend a test case a little
- b3a9e9897ec7 14.0 cited
-
Allow complemented character class escapes within regex brackets.
- 2a0af7fe460e 14.0 landed
-
Suppress compiler warning in new regex match-all detection code.
- 3db05e76f928 14.0 landed
-
Avoid generating extra subre tree nodes for capturing parentheses.
- ea1268f6301c 14.0 landed
-
Convert regex engine's subre tree from binary to N-ary style.
- 581043089472 14.0 landed
-
Fix regex engine to suppress useless concatenation sub-REs.
- cebc1d34e520 14.0 landed
-
Recognize "match-all" NFAs within the regex engine.
- 824bf71902db 14.0 landed
-
Invent "rainbow" arcs within the regex engine.
- 08c0d6ad65f7 14.0 landed
-
Make some minor improvements in the regex code.
- 4e703d67193d 14.0 landed
-
Display the time when the process started waiting for the lock, in pg_locks, take 2
- 46d6e5f56790 14.0 cited
-
README/C-comment: document GiST's NSN value
- 8facf1ea00b7 14.0 cited
-
doc: Mention NO DEPENDS ON EXTENSION in its supported ALTER commands
- 8063d0f6f56e 14.0 cited