.
D 2009-07-24T12:53:45
J assignee pvgoran
J cmimetype text/plain
J comment I\swas\sgoing\sto\suse\s[regexp\s-all\s-inline]\sto\ssplit\sa\sunified\sdiff\sinto\schunks,\s\nbut\sfound\sthat\sthis\swould\sskip\severy\ssecond\schunk.\sThis\sseems\sto\sbe\s\nrelated\sto\s^\snot\smatching\sthe\sbeginning\sof\sline\sif\sthe\snewline\sis\sbefore\s\nthe\s-start\sposition.\n\nSMALL\sEXAMPLE:\n\nset\sdata\s{\n@1\n\s2\n+3\n@4\n-5\n+6\n\s7\n@8\n\s9\n}\nregexp\s-all\s-inline\s{(?n)^@.*\\n(?:[^@].*\\n?)*}\s$data\n\nRETURNS\n\n{@1\n\s2\n+3\n}\s{@8\n\s9\n}\n\nRATHER\sTHAN\n\n{@1\n\s2\n+3\n}\s{@4\n-5\n+6\n\s7\n}\s{@8\n\s9\n}\n\nEXPLANATION:\sA\sdiff\schunk\sconsists\sof\sone\sheader\sline\sbeginning\swith\s@,\sfollowed\sby\sa\sbody\s\nconsisting\sof\slines\snot\sbeginning\swith\s@\s(but\srather\sspace,\splus,\sor\sminus).\sThe\sheader\sline\nis\sthus\sin\sline-sensitive\smode\smatched\sby\s^@.*\sand\sa\sbody\sline\sis\smatched\sby\s^[^@].*,\sso\s\na\ssensible\scombined\sregexp\sis\s(?n)^@.*\\n(?:[^@].*\\n?)*\s\sEach\schunk\sis\sindeed\smatched\sby\nthis,\sbut\swhen\s-all\sis\sused,\sonly\severy\ssecond\schunk\sis\sfound.\n\nIn\sthis\scase,\sdropping\sthe\s^\sfrom\sthe\sregexp\sallows\sall\schunks\sto\sbe\sfound:\n\n%\sregexp\s-all\s-inline\s{(?n)@.*\\n(?:[^@].*\\n?)*}\s$data\n{@1\n\s2\n+3\n}\s{@4\n-5\n+6\n\s7\n}\s{@8\n\s9\n}\n\nThis\ssuggests\sthe\sproblem\smay\sbe\sthat\s^\sfails\sto\smatch\swhen\sat\sthe\s-start\sposition,\sas\sone\sobvious\s\nway\sto\simplement\s[regexp\s-all]\sis\sas\sthe\sequivalent\sof\sa\sloop\saround\s[regexp\s-start].\sIndeed,\n\n%\sregexp\s-start\s1\s-indices\s{(?n)^a}\s"\\nab"\smatch\n0\n%\sregexp\s-start\s0\s-indices\s{(?n)^a}\s"\\nab"\smatch\n1\n%\sset\smatch\n1\s1\n\n
J foundin obsolete:\s8.6b1
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter lars_h
J subsystem 43.\sRegexp
J title Line-sensitivity\sat\s-start,\sbut\salso\s-all
J type Bug
K 2826551fffffffffffffffffffffffffffffffff
U lars_h
Z f290931d7f7e68e87588d6d92b4a76a0