So here's what I want to do:
input string: "abc From: blah"
I want to split this so that the result is
["abc" "From: blah"] or ["abc" "From" "blah"
I have several other patterns to match
["abcd" "To:" "blah"]
etc
So I have the following regex
val datePattern = """((.*>.*)|(.*(On).*(wrote:)$)|(.*(Date):.*(\+\d\d\d\d)?$)|(.*(From):.*(\.com)?(\]|>)?$))"""
val reg = datePattern.r
If I do a match the result comes out fine. If I do a split on the same regex I get an empty list.
inputStr match {
case reg(_*) => return "Match"
case _ => return "Output: None"
}
on the input string :
"abc From: blah blah"
returns Match
Split
inputStr.split(datePattern)
returns an empty array. What am I possibly missing ?