Shpigford Shpigford - 8 months ago 45
Ruby Question

Split on different newlines

Right now I'm doing a

on a string and assuming that the newline from the user is
like so:


What I'd like to do is split on either
or just

So how what would the regex be to split on either of those?


Did you try /\r?\n/ ? The ? makes the \r optional.

Example usage: