.
D 2015-05-17T14:55:33.378
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment since\sthere\sseems\sno\ssuitable\smailing\slist\sto\sask\sand\sI\spresume\sit's\sa\sbug\sI'm\sreporting\sthis\shere:\snon-greedy\smatching\sseems\snot\sto\swork\sas\sit\sshould\sin\scertain\scontexts,\sspecifically,\smatching\sseemingly\sbecomes\sgreedy\sif\sthe\srespective\satom\sis\spreceded\sby\sa\spattern\scontaining\s`+'\s\sto\sindicate\sarbitrary\s(one\sor\smore)\soccurrence\sof\schars\sfrom\sa\srange\sor\sclass.\r\n\r\nexample:\r\n\r\n#\sa\sstring\swith\sfour\ssub-patterns\sI\swant\sto\scapture\s(the\slatex-like\sconstructs\s`\\emph{xxx}'):\r\n\r\nset\ss\s"\\emph{A}\sa\s\\emph{B}\sb\s\\emph{C}\sc\s\\ital{D}\sd"\r\n\r\n#\sthis\sone\scorrectly\sfinds\sall\sfour\sof\sthem,\swhen\sspecifying\sthat\sthe\sstuff\sbefore\s`{xxx}'\sconsists\sof\sexactly\s4\sletters:\r\n\r\nregexp\s-all\s\s{(\\\\[a-z]{4})\\{(.*?)\\}}\s$s\sdum;\sputs\s$dum;\s#\s==>\s\\ital{D}\s\s<==\s(OK)\r\n\r\n#\sallowing\s"one\sor\smore"\schars\sinstead\sof\s"exactly\s4"\schanges\sthe\smatch\sto\s"greedy",\si.e.\sit\sreports\sa\s_single_\smatch\sof\r\n#\severyting\sup\sto\sthe\slast\sclosing\s`}':\r\n\r\nregexp\s-all\s\s{(\\\\[a-z]+)\\{(.*?)\\}}\s$s\sdum;\sputs\s$dum;\s#\s==\s>\s\\emph{A}\sa\s\\emph{B}\sb\s\\emph{C}\sc\s\\ital{D}\s<==(WRONG)\r\n\r\n#\sthe\ssame\sproblem\shere:\r\nregexp\s-all\s\s{(\\\\w+)\\{(.*?)\\}}\s$s\sdum;\sputs\s$dum;\s#\s==\s>\s\\emph{A}\sa\s\\emph{B}\sb\s\\emph{C}\sc\s\\ital{D}\s<==(WRONG)\r\n\r\n\r\nis\sthis\sa\sbug\sor\sam\sI\scompletely\smisunderstanding\show\snon-greedy\smatching\sis\ssupposed\sto\swork/be\sused?\r\n\r\nthanks\s\r\n\r\njoerg
J foundin 8.6
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact 87a8ab2e1e5150e17c388ae3d6a4369041a5c4fa
J resolution None
J severity Severe
J status Open
J submitter anonymous
J subsystem 43.\sRegexp
J title unexpected\snon\sgreedy\smatching\sbehaviour
J type Bug
K 11250a236da29e6badf7755a1b67995defa5170f
U anonymous
Z ddd2842c6abdb2a0dc2fcd8dcc933121