Artifacts Associated With Ticket 884d0ac78c
Ticket change [f14c2702b8] (rid 159862) by dkf on 2017-12-28 00:52:02:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/html"
- comment initialized to:
If you do: <pre> regexp -all {^|\n} "foo\nbar" </pre> then it returns <tt>3</tt>. I'd expect that (perhaps) with the <tt>-line</tt> option, but in standard mode that is rather "surprising" as there is only one place where the string starts and only one newline character. - foundin initialized to: "core-8-6-branch tip, 28-Dec-2017"
- is_private initialized to: "0"
- login: "dkf"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "dkf"
- subsystem initialized to: "43. Regexp"
- title initialized to:
Unexpected string-start constraint match in middle of string after newline
- type initialized to: "Bug"
Ticket change [5334e6a471] (rid 159883) by dkf on 2017-12-28 12:47:54:
- icomment:
A consequence of this issue is <a href="https://stackoverflow.com/q/47995488/301832">this</a>: <pre> % puts [regsub -all "^|\n" "foo\nbar" "\nXX"] XXfoo XX XXbar </pre> The double substitution of <tt>\nXX</tt> before <tt>bar</tt> is again "unexpected".
- login: "dkf"
- mimetype: "text/html"
- icomment:
Ticket change [232693a760] (rid 191998) by tgl on 2021-02-20 21:37:20:
- icomment:
FWIW, I can't reproduce this misbehavior in current Postgres: I get a correct-looking result from # select regexp_replace(E'foo\nbar', '^|\n', E'\nXX', 'g'); regexp_replace ---------------- + XXfoo + XXbar (1 row) I speculate that it got fixed as a side-effect of the constraint loop fixes we did awhile ago. I thought you guys had absorbed those, though. - login: "tgl"
- mimetype: "text/plain"
- icomment:
Ticket change [78b694ae93] (rid 257489) by serhiy.storchaka on 2026-10-10 17:51:51:
- icomment:
Same cause as [471101ffff]: with <tt>-all</tt>, each match was searched in the substring after the previous one, and <tt>^</tt> was allowed there whenever the previous character was a newline, even without <tt>-lineanchor</tt>. PostgreSQL, whose regex engine is derived from Tcl's, avoids this by passing the whole string with a search start offset. Proposed fix in branch [/timeline?r=regexp-all-search-start|regexp-all-search-start], which does the same: <tt>regexp -all {^|\n} "foo\nbar"</tt> would return 2, and the <tt>regsub</tt> example would give a single <tt>XX</tt> before <tt>bar</tt>. With <tt>-lineanchor</tt>, <tt>^</tt> still matches after a newline. Tests regexp-29.4 to 29.7. - login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [749e60014c] (rid 257636) by jan.nijtmans on 2026-10-11 20:06:59:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2461325.338193947"
- closer changed to: "jan.nijtmans"
- icomment: "Dup of [471101ffff]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Duplicate"
- status changed to: "Closed"