Skip to content

Commit

Permalink
Use forward slash delimiters in Regex.split doc (#14031)
Browse files Browse the repository at this point in the history
  • Loading branch information
rt-chang authored Dec 3, 2024
1 parent d49937c commit 41832ba
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/elixir/lib/regex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -567,31 +567,31 @@ defmodule Regex do
## Examples
iex> Regex.split(~r{-}, "a-b-c")
iex> Regex.split(~r/-/, "a-b-c")
["a", "b", "c"]
iex> Regex.split(~r{-}, "a-b-c", parts: 2)
iex> Regex.split(~r/-/, "a-b-c", parts: 2)
["a", "b-c"]
iex> Regex.split(~r{-}, "abc")
iex> Regex.split(~r/-/, "abc")
["abc"]
iex> Regex.split(~r{}, "abc")
iex> Regex.split(~r//, "abc")
["", "a", "b", "c", ""]
iex> Regex.split(~r{a(?<second>b)c}, "abc")
iex> Regex.split(~r/a(?<second>b)c/, "abc")
["", ""]
iex> Regex.split(~r{a(?<second>b)c}, "abc", on: [:second])
iex> Regex.split(~r/a(?<second>b)c/, "abc", on: [:second])
["a", "c"]
iex> Regex.split(~r{(x)}, "Elixir", include_captures: true)
iex> Regex.split(~r/(x)/, "Elixir", include_captures: true)
["Eli", "x", "ir"]
iex> Regex.split(~r{a(?<second>b)c}, "abc", on: [:second], include_captures: true)
iex> Regex.split(~r/a(?<second>b)c/, "abc", on: [:second], include_captures: true)
["a", "b", "c"]
iex> Regex.split(~r{-}, "-a-b--c", trim: true)
iex> Regex.split(~r/-/, "-a-b--c", trim: true)
["a", "b", "c"]
"""
Expand Down

0 comments on commit 41832ba

Please sign in to comment.