Looking at the link in the Elixir Getting Started Guide seems like this is not possible. The relevant section says:
However, we can match the rest of the binary modifier:
iex> <<0, 1, x :: binary>> = <<0, 1, 2, 3>> <<0, 1, 2, 3>> iex> x <<2, 3>>
The sample above only works if the binary is at the end of <<>> . Similar results can be achieved using the string concatenation operator <>
iex> "he" <> rest = "hello" "hello" iex> rest "llo"
Since strings are binaries under the hood in Elixir, matching suffix should be impossible for them.
source share