Skip to content
Tcl Source Code History Of Ticket 884d0ac78c
Login

History Of Ticket 884d0ac78c

Artifacts Associated With Ticket 884d0ac78c

  1. Ticket change [f14c2702b8] (rid 159862) by dkf on 2017-12-28 00:52:02:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/html"
    4. 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.
      
    5. foundin initialized to: "core-8-6-branch tip, 28-Dec-2017"
    6. is_private initialized to: "0"
    7. login: "dkf"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "dkf"
    13. subsystem initialized to: "43. Regexp"
    14. title initialized to:
      Unexpected string-start constraint match in middle of string after newline
      
    15. type initialized to: "Bug"
  2. Ticket change [5334e6a471] (rid 159883) by dkf on 2017-12-28 12:47:54:

    1. 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".
      
    2. login: "dkf"
    3. mimetype: "text/html"
  3. Ticket change [232693a760] (rid 191998) by tgl on 2021-02-20 21:37:20:

    1. 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.
      
    2. login: "tgl"
    3. mimetype: "text/plain"
  4. Ticket change [78b694ae93] (rid 257489) by serhiy.storchaka on 2026-10-10 17:51:51:

    1. 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.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [749e60014c] (rid 257636) by jan.nijtmans on 2026-10-11 20:06:59:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2461325.338193947"
    3. closer changed to: "jan.nijtmans"
    4. icomment: "Dup of [471101ffff]"
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Duplicate"
    8. status changed to: "Closed"