{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/5213","repository_url":"https://api.github.com/repos/elixir-lang/elixir","labels_url":"https://api.github.com/repos/elixir-lang/elixir/issues/5213/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/5213/comments","events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/5213/events","html_url":"https://github.com/elixir-lang/elixir/issues/5213","id":176806658,"number":5213,"title":"Documenting additional options for String.split/3","user":{"login":"jbranchaud","id":694063,"avatar_url":"https://avatars.githubusercontent.com/u/694063?v=3","gravatar_id":"","url":"https://api.github.com/users/jbranchaud","html_url":"https://github.com/jbranchaud","followers_url":"https://api.github.com/users/jbranchaud/followers","following_url":"https://api.github.com/users/jbranchaud/following{/other_user}","gists_url":"https://api.github.com/users/jbranchaud/gists{/gist_id}","starred_url":"https://api.github.com/users/jbranchaud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbranchaud/subscriptions","organizations_url":"https://api.github.com/users/jbranchaud/orgs","repos_url":"https://api.github.com/users/jbranchaud/repos","events_url":"https://api.github.com/users/jbranchaud/events{/privacy}","received_events_url":"https://api.github.com/users/jbranchaud/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-14T03:38:14Z","updated_at":"2016-09-14T08:05:21Z","closed_at":null,"body":"According to the documentation of [`String.split/3`](https://github.com/elixir-lang/elixir/blob/v1.3.2/lib/elixir/lib/string.ex#L241-L348), there are two supported options: `:trim` and `:parts`. However, because whenever `String.split` is invoked with a `Regex` pattern, it delegates to [`Regex.split/3`](https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/regex.ex#L333-L404), there end up being other available options, namely those available to `Regex.split` (`:on` and `:include_captures`).\r\n\r\n### Environment\r\n\r\n* Elixir 1.3.0\r\n* Operating system: OS X 10.11.6\r\n\r\n### Current behavior\r\n\r\nHere is an example of how that affects behavior of `String.split/3`:\r\n\r\n```elixir\r\n> String.split(\"23d\", ~r/\\d+/)\r\n[\"\", \"d\"]\r\n> String.split(\"23d\", ~r/\\d+/, trim: true)\r\n[\"d\"]\r\n> String.split(\"23d\", ~r/\\d+/, trim: true, include_captures: true)\r\n[\"23\", \"d\"]\r\n```\r\n\r\n### Expected behavior\r\n\r\nThis behavior seems reasonable, but as long as this is how it works, I propose that we add a note at the end of the `String.split/3` documentation directing people to `Regex.split/3` for details on `:include_captures` and `:on` options.\r\n\r\nI'd be glad to submit a PR with the proposed changes, but wanted to get some feedback first."},"comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments/246936883","html_url":"https://github.com/elixir-lang/elixir/issues/5213#issuecomment-246936883","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/5213","id":246936883,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T08:05:21Z","updated_at":"2016-09-14T08:05:21Z","body":"> This behavior seems reasonable, but as long as this is how it works, I propose that we add a note at the end of the String.split/3 documentation directing people to Regex.split/3 for details on :include_captures and :on options.\r\n\r\nYes, let's mention that when a regex is given, it accepts the same optins as `Regex.split/3`."}}
{"actor":{"display_login":"josevalim"}}