.
D 2000-10-26T01:05:19
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2117\sBug\nVersion:\s8.1\nSubmitDate:\s'1999-05-21'\nLastModified:\s'1999-08-04'\nSeverity:\sCRIT\nStatus:\sReleased\nSubmitter:\spat\nChangedBy:\sstanton\nOS:\sWindows\s98\nMachine:\sX86\nFixedDate:\s'1999-06-01'\nFixedInVersion:\s8.2b1\nClosedDate:\s'2000-10-25'\n\n\nName:\nChristopher\sNelson\n\nComments:\nSame\sbehaviour\son\sW98\sand\sWNT\swith\s8.1b2\sand\s8.1.0\n\nReproducibleScript:\nset\sfields\s{Name\sBirthdate\sNotes}\n\s\s\s\sset\sre\s"(?ix)\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sIgnore\scase\s(i),\sexpanded\ssyntax\s(x)\n\s\s\s\s\s\s\s\s\s\s\s\s^\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sStart\sat\sthe\sstart\sof\sthe\sstring\n\s\s\s\s\s\s\s\s\s\s\s\s([join\s$fields\s|])\s\s#\sMatch\sand\scapture\sany\sfield\snames\n\s\s\s\s\s\s\s\s\s\s\s\s:\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\s\s\sfollowed\sby\sa\scolon\n\s\s\s\s\s\s\s\s\s\s\s\s\\\\s*\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sOptional\swhite\sspace\safter\sthe\scolon\n\s\s\s\s\s\s\s\s\s\s\s\s(.*?)\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sCapture\sthe\srest\sof\sthe\sline\n\s\s\s\s\s\s\s\s\s\s\s\s\\\\s*\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\s\s\sexcluding\strailing\swhitespace\n\s\s\s\s\s\s\s\s\s\s\s\s$\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sUse\sthe\swhole\sline\n\s\s\s\s\s\s\s\s\s\s\s\s"\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s;#\sCan't\scomment\safter\sthe\s"\swithout\sa\s;\sto\s\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sterminate\sthe\sset\scommand\n\s\s\s\s#\sOpen\sthe\sinput\sfile\n\s\s\s\sset\sfid\s[open\sredata.txt\sr]\n\s\s\s\s#\sWhile\snot\sdone,\sread\sand\sprocess\sthe\snext\sline\n\s\s\s\swhile\s{!\s[eof\s$fid]\s}\s{\n\s\s\s\s\s\s\s\sset\slen\s[gets\s$fid\sline]\n\s\s\s\s\s\s\s\sswitch\s--\s$len\s{\n\s\s\s\s0\s{\n\s\s\s\s\s\s\s\s#\sSkip\sblank\slines\n\s\s\s\s\s\s\s\scontinue\n\s\s\s\s}\n\s\s\s\s-1\s{\n\s\s\s\s\s\s\s\s#\sEOF\n\s\s\s\s\s\s\s\sbreak\n\s\s\s\s}\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s#\sSee\sif\swe\scan\sparse\sthis\sline\n\s\s\s\s\s\s\s\sif\s{\s!\s[regexp\s$re\s$line\swhole\sfield\svalue]\s}\s{\n\s\s\s\s\s\s\s\s\s\s\sputs\sstderr\s"No\sfield\sfound\sin\s<<$line>>"\n\s\s\s\s\s\s\s\s\s\s\scontinue\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s#\sUse\scase-insensitive\sregexp\sto\smatch\sfields\n\s\s\s\s\s\s\s\s#\sWe\scould\sdo\s"set\sfield\s[string\stoupper\s$field]"\n\s\s\s\s\s\s\s\sswitch\s-regexp\s--\s$field\s{\n\s\s\s\s\s\s\s\s\s\s\s\s(?i)NAME\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sset\sname\s$value\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\slappend\sa(names)\s$name\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s\s\s\s\s(?i)BIRTHDATE\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sset\sa($name,dob)\s[clock\sscan\s$value]\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s\s\s\s\s(?i)NOTES\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sset\sa($name,notes)\s$value\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s\s\s\s\sdefault\s{\n\s\s\s\s\s\s\s\sputs\s"no\smatch\sin\sswitch"\n\s\s\s\s}\n\s\s\s\s\s\s\s\s}\n\s\s\s\s}\n\s\s\s\sclose\s$fid\n\s\s\s\s\n\s\s\s\s\n\s\s\s\sWhere\sredata.txt\scontains:\n\s\s\s\s\n\s\s\s\sName:\sFred\sFlintstone\s\s\s\n\s\s\s\sbirthdate:4/1/01\n\s\s\s\snotes:\sMember,\swater\sbuffalo\slodge\n\s\s\s\sname:Barney\sRubble\n\s\s\s\sbirthdate:5/15/09\n\s\s\s\snotes:\sNOT\sthe\spurple\sBarney!\n\nObservedBehavior:\nIf\sthe\ssecond\scapture\sis\s"(.*?)",\sthis\sscript\shangs.\sIf\sI\sremove\sthe\n\s\s\s\snon-greedy\squalifier,\sit\sworks\s(but\svalue\sis\sleft\swith\strailing\n\s\s\s\swhitespace).\n\s\s\s\s\n\s\s\s\sThis\sscript\sworks:\n\s\s\s\s\n\s\s\s\sset\sfields\s{Name\sBirthdate\sNotes}\n\s\s\s\sset\sline\s"Name:\sFred\sFlintstone\s\s\s"\n\s\s\s\s#\sThis\sworks\sbut\sleaves\svalue\swith\strailing\swhite\sspace\n\s\s\s\sset\sre\s"(?ix)^([join\s$fields\s|]):\\\\s*(.*)\\\\s*$"\n\s\s\s\sputs\s[regexp\s$re\s$line\swhole\sfield\svalue]\n\s\s\s\sputs\s"<<$value>>"\n\s\s\s\s#\sThis\stries\sto\smake\s(.*)\snon-greedy\s(so\strailing\swhite\sspace\sis\n\s\s\s\strimmed)\n\s\s\s\sset\sre\s"(?ix)^([join\s$fields\s|]):\\\\s*(.*?)\\\\s*$"\n\s\s\s\sputs\s[regexp\s$re\s$line\swhole\sfield\svalue]\n\s\s\s\sputs\s"<<$value>>"\n\s\s\s\s\n\s\s\s\sThe\sonly\sdifference\sseems\sto\sbe\sthat\sthe\sregexp\sisn't\sexpanded.\n\nDesiredBehavior:\nExpanded\sformat\sshouldn't\scause\sa\svalid\sRE\sto\shang\sTcl\n\n\n\nI've\sforwarded\sthis\sbug\sto\sHenry\sSpencer.\n05/27/1999\s11:23\s-\sstanton\s-\n06/01/1999\s18:44\s-\sstanton\s-Henry\ssent\sus\sa\spatch\sthat\sfixes\sthis\sproblem.\s\sIt\shas\sbeen\sapplied\sto\sthe\sCVS\srepository.\n\n
J foundin obsolete:\s8.1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 43.\sRegexp
J title regexp\shangs\swith\snon-greedy\soption\sin\sexpanded\sRE
J type Bug
K 218784ffffffffffffffffffffffffffffffffff
U nobody
Z 50b284460db54c97c55fa48c5801fb64