.
D 2026-10-11T08:18:34.972
J cmimetype text/x-fossil-wiki
J comment <tt>regexp\s-all</tt>\sdoes\snot\stry\sto\smatch\sat\sthe\send\sof\sthe\sstring,\sso\san\sRE\sthat\scan\smatch\sthe\sempty\sstring\sthere\smisses\sits\slast\smatch.\s<tt>regsub\s-all</tt>\sdoes\stry\sthere,\sso\sthe\stwo\sdisagree:\n<verbatim>\nregexp\s-all\s{a*}\sab\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s;#\s2,\sbut\sregsub\s-all\s{a*}\sab\s<&>\sgives\s<a><><>\s(3\smatches)\nregexp\s-all\s-inline\s-indices\s-line\s{$}\s"a\\n"\s\s\s;#\s{1\s0},\sbut\sthe\sempty\sline\sat\sthe\send\salso\smatches:\s{1\s0}\s{2\s1}\n</verbatim>\nPostgreSQL,\sPython,\sPerl,\sJava,\sRuby\sand\sJavaScript\sall\sreport\sthe\smatch\sat\sthe\send\s(3\smatches\sfor\sthe\sfirst\sexample).\sTests\sregexp-23.5,\s23.7\sand\s23.9,\sadded\sfor\s[2826551fff],\sexpect\sit\stoo,\sbut\sare\smarked\sknownBug.\n\nThe\scause\sis\sthe\send\sof\sthe\s<tt>-all</tt>\sloop\sin\s<tt>Tcl_RegexpObjCmd()</tt>:\sit\sstops\swhen\sthe\snext\soffset\sreaches\sthe\send\sof\sthe\sstring\s(<tt>offset\s>=\sstringLength</tt>),\swhile\s<tt>Tcl_RegsubObjCmd()</tt>\sloops\swhile\s<tt>offset\s<=\swlen</tt>.\sFixing\sit\schanges\sthe\snumber\sof\smatches\sthat\s<tt>regexp\s-all</tt>\sreports\sfor\ssuch\sREs,\sand\sseveral\sexisting\stests\s(regexp-18.8\sto\s18.10,\s23.2,\s23.3,\s26.10\sto\s26.13)\sthat\sexpect\sthe\scurrent\sresults.
J foundin 8.6.18,\s9.0.5,\s9.1.0
J login serhiy.storchaka
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J submitter serhiy.storchaka
J subsystem 43.\sRegexp
J title regexp\s-all\smisses\san\sempty\smatch\sat\sthe\send\sof\sthe\sstring
J type Bug
K b73f1296966202b2beeb14fec5534dec6a408012
U serhiy.storchaka
Z 1d4d7d5d0cffe46f69510a2d836432cd