{"thread":{"id":"36979","subject":"bug: git grep -P and multiline mode","startedAt":"2014-06-23T06:54:29Z","lastAt":"2014-06-24T07:34:44Z","messageCount":3,"participants":["Noel Grandin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"244843","messageId":"53A7CF25.7060508@gmail.com","threadId":"36979","inReplyTo":null,"subject":"bug: git grep -P and multiline mode","fromName":"Noel Grandin","fromEmail":"noelgrandin@gmail.com","sentAt":"2014-06-23T06:54:29Z","receivedAt":"2014-06-23T06:54:29Z","isPatch":false,"sender":{"key":"noelgrandin@gmail.com","avatar":"https://gravatar.com/avatar/b685e19fd968554f6be11c7ce8f8bca0b38b6b22e3e07504f7aefae16a234374?d=mp&s=160"},"body":"Hi\n\nIt looks like the perl regular expression multiline mode does not work with 'git grep'\n\nfor example, something like\n\n    git grep -P '(?s)foo.*?bar\"\n\nwill not match a file in the repo where it has something like\n\n    foo\n    bar\n\nie. split across two lines\n\nRegards, Noel Grandin\n"},{"id":"244886","messageId":"xmqqa993cykl.fsf@gitster.dls.corp.google.com","threadId":"36979","inReplyTo":"53A7CF25.7060508@gmail.com","subject":"Re: bug: git grep -P and multiline mode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-23T17:42:18Z","receivedAt":"2014-06-23T17:42:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Noel Grandin <noelgrandin@gmail.com> writes:\n\n> It looks like the perl regular expression multiline mode does not work with 'git grep'\n\nYes, and deliberately so, to avoid having to think about things like\n\"how would a multi-line match interact with 'grep -n'?\"\n\nWe behave as if we feed each line of the contents one line at a time\nto the matching engine that is chosen by the -P/-E/-G/-F optoins, so\nthis limitation is unlikely to change.\n"},{"id":"244913","messageId":"53A92A14.8010607@gmail.com","threadId":"36979","inReplyTo":"xmqqa993cykl.fsf@gitster.dls.corp.google.com","subject":"Re: bug: git grep -P and multiline mode","fromName":"Noel Grandin","fromEmail":"noelgrandin@gmail.com","sentAt":"2014-06-24T07:34:44Z","receivedAt":"2014-06-24T07:34:44Z","isPatch":false,"sender":{"key":"noelgrandin@gmail.com","avatar":"https://gravatar.com/avatar/b685e19fd968554f6be11c7ce8f8bca0b38b6b22e3e07504f7aefae16a234374?d=mp&s=160"},"body":"On 2014-06-23 07:42 PM, Junio C Hamano wrote:\n> Noel Grandin <noelgrandin@gmail.com> writes:\n>\n>> It looks like the perl regular expression multiline mode does not work with 'git grep'\n> Yes, and deliberately so, to avoid having to think about things like\n> \"how would a multi-line match interact with 'grep -n'?\"\n>\n>\n\nAh, that is a pity.\n\nI find the multi-line mode very useful for finding code problems that span multiple lines.\n\nI'm sure there are other options that conflict, and the solution is to normally write out some kind of informative error \nmessage?\n\nAnyhow, since I'm too busy working on LibreOffice right now to work up a patch for git, I'll stick to using\n     find | xargs grep\n:-)\n"}]}