Trouble splitting text at newlines

I am having trouble splitting lines of text in Phoenix. If I do the following in the Phoenix shell (iex -S mix phoenix.server) all is good:

iex(22)> text = "bird.orange\nbird.blue"
"bird.orange\nbird.blue"
iex(23)> Regex.split( ~r/\r|\n|\r\n/, text)
["bird.orange", "bird.blue"]

I have similar code in my app – Regex.split( ~r/\r|\n|\r\n/, String.trim(text))
that does not split the string.

Any ideas? Going crazy on this one.

1 Like