I want split abcd\r\nabc\r\nppp to (abcd\r\nabc, ppp) with regex "(.*)\r\n(.*)".r.
but the regex match fail as this:
object Regex extends App {
val r = "(.*)\r\n(.*)".r
val str = "abcd\r\nabc\r\nppp"
str match {
case r(a,b) =>
println((a,b))
case _ =>
println("fail - ")
}
}
console print fail -.
It works fine if use the Regex match abcd\r\nppp, code again:
object Regex extends App {
val r = "(.*)\r\n(.*)".r
val str = "abcd\r\nppp"
str match {
case r(a,b) =>
println((a,b))
case _ =>
println("fail - ")
}
}
Besides, I don't want replace \r\n to other characters.It's waste calculate resource, because the code is used to performance sensitive stage.
Thanks