{"action":"created","issue":{"url":"https://api.github.com/repos/vqmod/vqmod/issues/16","labels_url":"https://api.github.com/repos/vqmod/vqmod/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/vqmod/vqmod/issues/16/comments","events_url":"https://api.github.com/repos/vqmod/vqmod/issues/16/events","html_url":"https://github.com/vqmod/vqmod/issues/16","id":53701004,"number":16,"title":"[Feature Request] Multiline Search","user":{"login":"timint","id":359192,"avatar_url":"https://avatars.githubusercontent.com/u/359192?v=3","gravatar_id":"","url":"https://api.github.com/users/timint","html_url":"https://github.com/timint","followers_url":"https://api.github.com/users/timint/followers","following_url":"https://api.github.com/users/timint/following{/other_user}","gists_url":"https://api.github.com/users/timint/gists{/gist_id}","starred_url":"https://api.github.com/users/timint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timint/subscriptions","organizations_url":"https://api.github.com/users/timint/orgs","repos_url":"https://api.github.com/users/timint/repos","events_url":"https://api.github.com/users/timint/events{/privacy}","received_events_url":"https://api.github.com/users/timint/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-08T00:34:58Z","updated_at":"2015-02-07T03:35:57Z","closed_at":null,"body":"I would like to push for a discussion of multiline search support.\r\nHere is something I came up with that could be useful for starters:\r\n\r\n    function preg_replacement_quote($string) {\r\n      return preg_replace('#(\\$|\\\\\\\\)(?=\\d)#', '\\\\\\\\\\1', $string);\r\n    }\r\n\r\n    function modify_string($haystack, $search, $insert, $operation) {\r\n      \r\n      $search_regexp = preg_split(\"#\\R+#\", trim($search)); // Convert multiple lines to array\r\n      foreach(array_keys($search_regexp) as $key) {\r\n        $search_regexp[$key] = preg_quote(trim($search_regexp[$key]), '#'); // Turn line into regular expression\r\n      }\r\n      $search_regexp = \"#(\\\\s+?\" . implode('\\\\s+', $search_regexp) . \"\\\\s+?)#\"; // Glue\r\n      \r\n      switch($operation) {\r\n        case 'prepend':\r\n          return preg_replace($search_regexp, '$1' . $insert, $haystack);\r\n        case 'replace':\r\n          return preg_replace($search_regexp, $insert, $haystack);\r\n        case 'append':\r\n          return preg_replace($search_regexp, preg_replacement_quote($insert) . '$1', $haystack);\r\n        default:\r\n          trigger_error(\"Unknown operation ($operation)\", E_USER_ERROR);\r\n      }\r\n    }\r\n\r\nThe code should not be used for production. I had some troubles escaping $insert where PHP replaced both $1 and \\\\1 with the first matched pair."},"comment":{"url":"https://api.github.com/repos/vqmod/vqmod/issues/comments/73347971","html_url":"https://github.com/vqmod/vqmod/issues/16#issuecomment-73347971","issue_url":"https://api.github.com/repos/vqmod/vqmod/issues/16","id":73347971,"user":{"login":"JAY6390","id":696920,"avatar_url":"https://avatars.githubusercontent.com/u/696920?v=3","gravatar_id":"","url":"https://api.github.com/users/JAY6390","html_url":"https://github.com/JAY6390","followers_url":"https://api.github.com/users/JAY6390/followers","following_url":"https://api.github.com/users/JAY6390/following{/other_user}","gists_url":"https://api.github.com/users/JAY6390/gists{/gist_id}","starred_url":"https://api.github.com/users/JAY6390/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JAY6390/subscriptions","organizations_url":"https://api.github.com/users/JAY6390/orgs","repos_url":"https://api.github.com/users/JAY6390/repos","events_url":"https://api.github.com/users/JAY6390/events{/privacy}","received_events_url":"https://api.github.com/users/JAY6390/received_events","type":"User","site_admin":false},"created_at":"2015-02-07T03:35:57Z","updated_at":"2015-02-07T03:35:57Z","body":"Hi Tim\r\n\r\nThanks for the feedback. We've discussed the multiline issue a few times privately and have already worked out a way that it could be implemented. However, with the OCMod integration into OpenCart we'd decided to hold back and see what was going on with it and if it was worth actively pursuing VQMod's feature enhancements.\r\n\r\nOn a tangent, I see you're the developer of LiteCart. I took a look a while ago and was really impressed with it and see you integrated VQMod into the core which is great. If I recall correctly you weren't using MVC at the time (around summer last year) for LiteCart which put me off using it and developing extensions for it to be honest. Hopefully this isn't still the case with your new release? I'll have to download and check at some point when I get a moment\r\n\r\nKind regards\r\nJay"}}