Skip to content
Tcl Source Code Artifact [4c12dfb3b7]
Login

Artifact [4c12dfb3b7]

Artifact 4c12dfb3b7dbd4a3e4e0da1a5eeff10f7c2065d1979ef471f97abd068208b49d:

Ticket change [4c12dfb3b7] - Ticket [3574242fffffffff|3574242fff] <i>exact match is greedy by reluctant exact match quantifier</i> status still Open with 3 other changes by sebres on 2019-11-22 20:24:39.
D 2019-11-22T20:24:39.354
J icomment After\spretty\sproductive\sdiscussion\sin\stclchat\swith\sAndrew\sGierth\s(RhodiumToad)\swe\shave\snew\sother\sfindings\snow.\r\n\r\nThe\snew\shandling\sof\squantifier\s"+"\s(in\scontrary\sto\s"*")\sas\swell\sas\s"{1,}"\s(in\scontrary\sto\s"{0,}")\smakes\simpossible\sto\sretrieve\sindices\sof\slast\ssuccessful\smatched\scapturing\sgroups,\swhich\sresults\sto\simpossibly\sto\sdifferentiate\swhich\ssub-group\s(expression)\scauses\sthe\smatch\sexactly.\r\n\r\nI\shope\sfollowing\sexample\swould\sillustrate\sthat:\r\n\r\n<pre>\r\n\s\s\s\s%\sregexp\s-indices\s-inline\s<b\sstyle="background-color:#dfd">{<b\sstyle="background-color:#dff">(<b\sstyle="color:red">(a?)*</b>|<b\sstyle="color:blue">(b?)*</b>)</b>*}</b>\saaa\r\n\s\s\s\s<b\sstyle="background-color:#dfd">{0\s2}\s<b\sstyle="background-color:#dff">{0\s2}\s<b\sstyle="color:red">{2\s2}</b></b></b>\s<b\sstyle="color:blue">{-1\s-1}</b>\r\n\s\s\s\s%\sregexp\s-indices\s-inline\s<b\sstyle="background-color:#dfd">{<b\sstyle="background-color:#dff">(<b\sstyle="color:red">(a?)*</b>|<b\sstyle="color:blue">(b?)*</b>)</b>+}</b>\saaa\r\n\s\s\s\s<b\sstyle="background-color:#dfd">{0\s2}</b>\s<b\sstyle="background-color:#dff">{3\s2}</b>\s<b\sstyle="color:red">{-1\s-1}</b>\s<b\sstyle="color:blue">{-1\s-1}</b>\r\n</pre>\r\n\r\nSo\sit\sis\sbasically\simpossible\sto\sdifferentiate\swhich\sof\slast\schild\ssub-group\s<b\sstyle="color:red">(a?)*</b>\sor\s<b\sstyle="color:blue">(b?)*</b>\scaused\sa\smatch\sof\sthe\sparent\s(which\sis\salso\smistakenly\san\sempty\smatch\soutside\sof\sstring\s-\s<b\sstyle="background-color:#dff"><code>{3\s2}</code></b>),\sas\swell\sas\sthe\sto\sretrieve\sthe\slast\sindices\sfor\sthat,\sbecause\sboth\sare\s<b><code>{-1\s-1}</code></b>,\sif\s"+"\squantifier\swas\sused\sin\ssome\sparent\sexpression.\r\n\r\nThe\ssame\sis\svalid\sfor\sthis\s(note\sthe\s"*"\sinstead\sof\s"?"\sin\sboth\slast\snesting\sgroups):\r\n<pre>\r\n\s\s\s\s%\sregexp\s-indices\s-inline\s<b\sstyle="background-color:#dfd">{<b\sstyle="background-color:#dff">(<b\sstyle="color:red">(a*)*</b>|<b\sstyle="color:blue">(b*)*</b>)</b>*}</b>\saaa\r\n\s\s\s\s<b\sstyle="background-color:#dfd">{0\s2}\s<b\sstyle="background-color:#dff">{0\s2}\s<b\sstyle="color:red">{0\s2}</b></b></b>\s<b\sstyle="color:blue">{-1\s-1}</b>\r\n\s\s\s\s%\sregexp\s-indices\s-inline\s<b\sstyle="background-color:#dfd">{<b\sstyle="background-color:#dff">(<b\sstyle="color:red">(a*)*</b>|<b\sstyle="color:blue">(b*)*</b>)</b>+}</b>\saaa\r\n\s\s\s\s<b\sstyle="background-color:#dfd">{0\s2}</b>\s<b\sstyle="background-color:#dff">{3\s2}</b>\s<b\sstyle="color:red">{-1\s-1}</b>\s<b\sstyle="color:blue">{-1\s-1}</b>\r\n</pre>\r\n\r\nEither\sone\swould\sexpect\sthe\ssame\sresult\sas\susing\s"*"\sinstead\sof\s"+"\shere.<br/>\r\nOr\sif\sthe\sdecision\sis\ssub-expression\smatches\sempty\sstring,\sthe\sindices\sshall\sbe\sstill\sinside\sthe\sparent\s(empty\sbut\snot\soutside),\sso\swe\sshould\sget\ssomething\slike\sthis\sfor\sboth\scases\swith\s"+"\squantifier:<br/>\r\n<pre>\r\n\s\s\s\s%\sregexp\s-indices\s-inline\s<b\sstyle="background-color:#dfd">{<b\sstyle="background-color:#dff">(<b\sstyle="color:red">(a?)*</b>|<b\sstyle="color:blue">(b?)*</b>)</b>+}</b>\saaa\r\n\s\s\s\s%\sregexp\s-indices\s-inline\s<b\sstyle="background-color:#dfd">{<b\sstyle="background-color:#dff">(<b\sstyle="color:red">(a*)*</b>|<b\sstyle="color:blue">(b*)*</b>)</b>+}</b>\saaa\r\n\s\s\s\s<b\sstyle="background-color:#dfd">{0\s2}\s<b\sstyle="background-color:#dff">{2\s1}\s<b\sstyle="color:red">{2\s1}</b></b></b>\s<b\sstyle="color:blue">{-1\s-1}</b>\r\n</pre>\r\n\r\nAndrew\sis\salso\sgoing\sto\sfile\sthis\sas\sa\sPostgres\sbug...<br/>\r\nHere\sis\s[https://www.postgresql.org/message-id/16133-a8934caee4e53035%40postgresql.org|the\sissue\sin\sPG].
J login sebres
J mimetype text/x-fossil-wiki
K 3574242fffffffffffffffffffffffffffffffff
U sebres
Z 9598446687360d095f42c76743317107