Overview
| Artifact ID: | 78b694ae93a6f1c233bf7ad1641b182f3bc6f53709a9ad05d7dacd5bf4ad6627 |
|---|---|
| Ticket: | 884d0ac78cbab248d054ec96d13c2a741bb0a94c
Unexpected string-start constraint match in middle of string after newline |
| User & Date: | serhiy.storchaka on 2026-10-10 17:51:51 |
Changes
- 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"