Right now I\'m doing a split on a string and assuming that the newline from the user is \\r\\n like so:
split
\\r\\n
string.split(/\\r\\n/) <
string.split(/\\r\\n/)
The alternation operator in Ruby Regexp is the same as in standard regular expressions: |
Regexp
|
So, the obvious solution would be
/\r\n|\n/
which is the same as
/\r?\n/
i.e. an optional \r followed by a mandatory \n.
\r
\n