Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # <> operator allows the input parameters to be pattern matched
- # input = "# This will be an h1"
- # h = "#"
- # t = "This will be an h1"
- defp parse_header_tag(input = "#" <> _) do
- [h|t] = String.split(input)
- construct_header(String.length(h), Enum.join(t, " "))
- end
- # input = "__This will be bold__"
- defp parse_header_tag(input) do
- end
- # String.replace
- "__This will be bold__" |> String.replace(~r/__([^_]+)__/, "") -> ""
- "__This will be bold__" |> String.replace(~r/__([^_]+)__/, "<strong>\\1</strong>")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement