.
D 2000-10-26T00:56:47
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s4233\sRFE\nVersion:\s8.3\nSubmitDate:\s'2000-02-23'\nLastModified:\s'2000-02-23'\nSeverity:\sMED\nStatus:\sClosed\nSubmitter:\stechsupp\nChangedBy:\shobbs\nOS:\sAll\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-02-23'\n\n\nName:\nVince\sDarley\n\nReproducibleScript:\nThis\sis\scorrect:\n\n%\sregexp\s-start\s1\s-lineanchor\s{^[a-z]*}\s"a\\naaa"\sfound\n1\n%\sset\sfound\naaa\n\nHowever\sif\swe\sinstead\suse\s'-start\s2',\sthe\sregexp\sfails:\n\n%\sregexp\s-start\s2\s-lineanchor\s{^[a-z]*}\s"a\\naaa"\sfound\n0\n\neven\sthough\sposition\s2\sis\sin\sfact\sa\ssuitable\sposition\sfor\s^\sto\smatch\sas\sa\slineanchor.\s\sThe\sproblem\sis\sthat\s'-start'\sis\simplemented\sin\stoo\ssimplistic\sa\sway\s(and\swe\scould\simplement\sa\ssimilar\s'-end'\swith\ssimilar\sproblems\swith\s$)\s--\sit\sjust\spasses\s'string\srange\s$text\s$start\send'\sto\sthe\sregexp\scode,\sand\sturns\soff\sthe\sability\sof\s'^'\sto\smatch\sthe\sbeginning\sof\sstring.\n\nThe\sbest\ssolution\sis\sto\sadd\sproper\ssupport\sfor\s-start\s(and\s-end\sIMHO)\sto\sHenry\sSpencer's\sregexp\scode.\n\nFor\sa\sgeneral\sworkaround,\sconsider:\sgiven\sa\sgeneric\s$pat,\sand\sa\sgeneric\s$text,\sif\swe\swish\sto\sknow\sthe\sresult\sof:\n\nregexp\s-start\s2\s-lineanchor\s--\s$pat\s$text\sresult\n\nThen\spossible\sworkarounds\sneed\sto\sexamine\swhether\s'string\sindex\s$text\s1'\sis\sa\snewline\sor\snot.\s\sIf\sit\sis\snot\sa\snewline,\sthen\sI\sthink\severything\sshould\swork\sok.\s\sIf\sit\sis\sa\snewline,\sI\sthink\sthe\sbest\ssolution\sis\sto\suse:\s'regexp\s-lineanchor\s--\s$pat\s[string\srange\s$text\s2\send]\sinstead'.\s\sI'm\snot\ssure\swhether\sthat\sactually\scovers\sall\spossible\sproblems...\n\nSo\sperhaps:\s\n\nif\s{$start\s>\s0\s&&\s[regexp\s{[\\r\\n]}\s[string\sindex\s$text\s$start]]}\s{\n\s\s\s\sregexp\s-lineanchor\s--\s$pat\s[string\srange\s$text\s$start\send]\sresult\n}\selse\s{\n\s\s\s\sregexp\s-start\s$start\s-lineanchor\s--\s$pat\s$text\sresult\n}\n\nOf\scourse\sif\swe\sactually\swant\s'-indices'\swe\sthen\shave\sto\sadjust\sthe\sindices\sin\sthe\sresults\sappropriately\sby\sthe\soffset\swe\sare\susing...\s\s\sSo\sa\sgeneral\sworkaround\sis\skind\sof\sa\spain!\n\nConclusion:\sperhaps\sthis\sshould\sbe\san\sRFE\sfor\sa\smore\scomplete\simplementation\sof\s-start\s(and\s-end).\s\sAn\salternative\sfix\swould\sbe\sfor\sTcl_RegexpObjCmd\sto\scheck\swhether\sthe\scharacter\sbefore\sthe\s-start\sis\sa\snewline\s\\r\\n\sor\snot,\sand\sif\sit\s_is_,\sthen\sdon't\sturn\soff\sthe\sability\sof\s'^'\sto\smatch\sthe\sbeginning\sof\sthe\sstring!\n\nI\sassume\s'regsub'\ssuffers\sfrom\ssimilar\sproblems.\n\n\n\nThe\sregexp\s-start\sdoesn't\sdo\san\simplicit\sstring\srange,\sit\suses\sthe\nfacilities\sthat\sHS\sprovided\sfor\sjust\ssuch\sa\sfeature.\s\sThe\seffect\son\n'^'\sis\sdocumented,\sand\sdue\sto\slimitations\sin\sthe\sexposed\sinterface.\s\n--\s02/23/2000\shobbs
J foundin obsolete:\s8.3
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 43.\sRegexp
J title regexp\s-start,\s-lineanchor\sdon't\scombine\swell
J type Bug
K 218370ffffffffffffffffffffffffffffffffff
U nobody
Z a28ec8f5c5f7227c7967ff31dfa27a34