{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/49933468","id":49933468,"diff_hunk":"@@ -397,30 +404,72 @@ defmodule Regex do\n   defp parts_to_index(:infinity),                      do: 0\n   defp parts_to_index(n) when is_integer(n) and n > 0, do: n\n \n-  defp do_split(_, string, offset, _counter, true) when byte_size(string) <= offset,\n+  defp do_split(_, string, offset, _counter, true, _with_captures) when byte_size(string) <= offset,\n     do: []\n \n-  defp do_split(_, string, offset, 1, _trim),\n+  defp do_split(_, string, offset, 1, _trim, _with_captures),\n     do: [binary_part(string, offset, byte_size(string) - offset)]\n \n-  defp do_split([], string, offset, _counter, _trim),\n+  defp do_split([], string, offset, _counter, _trim, _with_captures),\n     do: [binary_part(string, offset, byte_size(string) - offset)]\n \n-  defp do_split([[{pos, _}|h]|t], string, offset, counter, trim) when pos - offset < 0,\n-    do: do_split([h|t], string, offset, counter, trim)\n+  defp do_split([[{pos, _}|h]|t], string, offset, counter, trim, with_captures) when pos - offset < 0,\n+    do: do_split([h|t], string, offset, counter, trim, with_captures)\n \n-  defp do_split([[]|t], string, offset, counter, trim),\n-    do: do_split(t, string, offset, counter, trim)\n+  defp do_split([[]|t], string, offset, counter, trim, with_captures),\n+    do: do_split(t, string, offset, counter, trim, with_captures)\n+\n+  defp do_split([[{pos, length}|h]|t], string, offset, counter, true, false) do\n+    new_offset = pos + length\n+    keep = pos - offset\n+\n+    if keep == 0 do\n+      do_split([h|t], string, new_offset, counter, true, false)\n+    else\n+      <<_::binary-size(offset), part::binary-size(keep), _::binary>> = string\n+      [part | do_split([h|t], string, new_offset, counter - 1, true, false)]\n+    end\n+  end\n \n-  defp do_split([[{pos, length}|h]|t], string, offset, counter, trim) do\n+  defp do_split([[{pos, length}|h]|t], string, offset, counter, false, false) do\n     new_offset = pos + length\n     keep = pos - offset\n \n-    if keep == 0 and (length == 0 or trim) do\n-      do_split([h|t], string, new_offset, counter, trim)\n+    if keep == 0 and length == 0 do\n+      do_split([h|t], string, new_offset, counter, false, false)\n     else\n       <<_::binary-size(offset), part::binary-size(keep), _::binary>> = string\n-      [part|do_split([h|t], string, new_offset, counter - 1, trim)]\n+      [part | do_split([h|t], string, new_offset, counter - 1, false, false)]\n+    end\n+  end\n+\n+  defp do_split([[{pos, length}|h]|t], string, offset, counter, true, true) do\n+    new_offset = pos + length\n+    keep = pos - offset\n+\n+    if keep == 0 and length == 0 do\n+      do_split([h|t], string, new_offset, counter, true, true)\n+    else\n+      <<_::binary-size(offset), part::binary-size(keep), match::binary-size(length), _::binary>> = string\n+\n+      if keep == 0 do\n+        [match | do_split([h|t], string, new_offset, counter - 1, true, true)]\n+      else\n+        [part | [match | do_split([h|t], string, new_offset, counter - 1, true, true)]]","path":"lib/elixir/lib/regex.ex","position":96,"original_position":96,"commit_id":"572f8ee7f2db77981637fbc7b9017023a28e6351","original_commit_id":"572f8ee7f2db77981637fbc7b9017023a28e6351","user":{"login":"druzn3k","id":1090201,"avatar_url":"https://avatars.githubusercontent.com/u/1090201?v=3","gravatar_id":"","url":"https://api.github.com/users/druzn3k","html_url":"https://github.com/druzn3k","followers_url":"https://api.github.com/users/druzn3k/followers","following_url":"https://api.github.com/users/druzn3k/following{/other_user}","gists_url":"https://api.github.com/users/druzn3k/gists{/gist_id}","starred_url":"https://api.github.com/users/druzn3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druzn3k/subscriptions","organizations_url":"https://api.github.com/users/druzn3k/orgs","repos_url":"https://api.github.com/users/druzn3k/repos","events_url":"https://api.github.com/users/druzn3k/events{/privacy}","received_events_url":"https://api.github.com/users/druzn3k/received_events","type":"User","site_admin":false},"body":":+1: ","created_at":"2016-01-16T16:04:51Z","updated_at":"2016-01-16T16:04:51Z","html_url":"https://github.com/elixir-lang/elixir/pull/4207#discussion_r49933468","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/49933468"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4207#discussion_r49933468"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207"}}},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207","id":56255222,"html_url":"https://github.com/elixir-lang/elixir/pull/4207","diff_url":"https://github.com/elixir-lang/elixir/pull/4207.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/4207.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4207","number":4207,"state":"open","locked":false,"title":"Implemented option :include_captures in Regex.split/3","user":{"login":"druzn3k","id":1090201,"avatar_url":"https://avatars.githubusercontent.com/u/1090201?v=3","gravatar_id":"","url":"https://api.github.com/users/druzn3k","html_url":"https://github.com/druzn3k","followers_url":"https://api.github.com/users/druzn3k/followers","following_url":"https://api.github.com/users/druzn3k/following{/other_user}","gists_url":"https://api.github.com/users/druzn3k/gists{/gist_id}","starred_url":"https://api.github.com/users/druzn3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druzn3k/subscriptions","organizations_url":"https://api.github.com/users/druzn3k/orgs","repos_url":"https://api.github.com/users/druzn3k/repos","events_url":"https://api.github.com/users/druzn3k/events{/privacy}","received_events_url":"https://api.github.com/users/druzn3k/received_events","type":"User","site_admin":false},"body":"Closes issue #4203. Not the prettiest implementation, but it does work. Any suggestion on how to make it better, please?","created_at":"2016-01-16T14:54:22Z","updated_at":"2016-01-16T16:04:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41f99f7c54681baeccdd33a09079659c67aea507","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4207/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/572f8ee7f2db77981637fbc7b9017023a28e6351","head":{"label":"druzn3k:issue_4203","ref":"issue_4203","sha":"572f8ee7f2db77981637fbc7b9017023a28e6351","user":{"login":"druzn3k","id":1090201,"avatar_url":"https://avatars.githubusercontent.com/u/1090201?v=3","gravatar_id":"","url":"https://api.github.com/users/druzn3k","html_url":"https://github.com/druzn3k","followers_url":"https://api.github.com/users/druzn3k/followers","following_url":"https://api.github.com/users/druzn3k/following{/other_user}","gists_url":"https://api.github.com/users/druzn3k/gists{/gist_id}","starred_url":"https://api.github.com/users/druzn3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druzn3k/subscriptions","organizations_url":"https://api.github.com/users/druzn3k/orgs","repos_url":"https://api.github.com/users/druzn3k/repos","events_url":"https://api.github.com/users/druzn3k/events{/privacy}","received_events_url":"https://api.github.com/users/druzn3k/received_events","type":"User","site_admin":false},"repo":{"id":44813852,"name":"elixir","full_name":"druzn3k/elixir","owner":{"login":"druzn3k","id":1090201,"avatar_url":"https://avatars.githubusercontent.com/u/1090201?v=3","gravatar_id":"","url":"https://api.github.com/users/druzn3k","html_url":"https://github.com/druzn3k","followers_url":"https://api.github.com/users/druzn3k/followers","following_url":"https://api.github.com/users/druzn3k/following{/other_user}","gists_url":"https://api.github.com/users/druzn3k/gists{/gist_id}","starred_url":"https://api.github.com/users/druzn3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druzn3k/subscriptions","organizations_url":"https://api.github.com/users/druzn3k/orgs","repos_url":"https://api.github.com/users/druzn3k/repos","events_url":"https://api.github.com/users/druzn3k/events{/privacy}","received_events_url":"https://api.github.com/users/druzn3k/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/druzn3k/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":true,"url":"https://api.github.com/repos/druzn3k/elixir","forks_url":"https://api.github.com/repos/druzn3k/elixir/forks","keys_url":"https://api.github.com/repos/druzn3k/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/druzn3k/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/druzn3k/elixir/teams","hooks_url":"https://api.github.com/repos/druzn3k/elixir/hooks","issue_events_url":"https://api.github.com/repos/druzn3k/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/druzn3k/elixir/events","assignees_url":"https://api.github.com/repos/druzn3k/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/druzn3k/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/druzn3k/elixir/tags","blobs_url":"https://api.github.com/repos/druzn3k/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/druzn3k/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/druzn3k/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/druzn3k/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/druzn3k/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/druzn3k/elixir/languages","stargazers_url":"https://api.github.com/repos/druzn3k/elixir/stargazers","contributors_url":"https://api.github.com/repos/druzn3k/elixir/contributors","subscribers_url":"https://api.github.com/repos/druzn3k/elixir/subscribers","subscription_url":"https://api.github.com/repos/druzn3k/elixir/subscription","commits_url":"https://api.github.com/repos/druzn3k/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/druzn3k/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/druzn3k/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/druzn3k/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/druzn3k/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/druzn3k/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/druzn3k/elixir/merges","archive_url":"https://api.github.com/repos/druzn3k/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/druzn3k/elixir/downloads","issues_url":"https://api.github.com/repos/druzn3k/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/druzn3k/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/druzn3k/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/druzn3k/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/druzn3k/elixir/labels{/name}","releases_url":"https://api.github.com/repos/druzn3k/elixir/releases{/id}","created_at":"2015-10-23T13:11:11Z","updated_at":"2016-01-16T09:16:08Z","pushed_at":"2016-01-16T15:43:09Z","git_url":"git://github.com/druzn3k/elixir.git","ssh_url":"git@github.com:druzn3k/elixir.git","clone_url":"https://github.com/druzn3k/elixir.git","svn_url":"https://github.com/druzn3k/elixir","homepage":"http://elixir-lang.org/","size":33165,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elixir-lang:master","ref":"master","sha":"a43e6fcdaa77970d074665f7aba6b2595fbf00c5","user":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"name":"elixir","full_name":"elixir-lang/elixir","owner":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","created_at":"2011-01-09T08:43:57Z","updated_at":"2016-01-16T12:37:32Z","pushed_at":"2016-01-16T15:43:10Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":41278,"stargazers_count":5990,"watchers_count":5990,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":828,"mirror_url":null,"open_issues_count":50,"forks":828,"open_issues":50,"watchers":5990,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4207"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4207"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4207/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4207/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/572f8ee7f2db77981637fbc7b9017023a28e6351"}}}}