I have an array of regex's in Scala, and am trying to verify that a message body contains anything in the regex. However, in the messageBody variable I'm getting a Pattern type is incompatible with given type, expected Array[Regex], found Array[String]. How can I pass in a proper case?
A few other posts have suggested using Pattern but that hasn't worked in my case.
val messageBody: Array[String] = message.body.split(' ')
val unsubscribeTriggers: Array[Regex] = Array("unsubscribe/i".r, "stop/i".r, "stopall/i".r, "cancel/i".r, "end/i".r, "quit/i".r)\
if (messageBody.length == 1) {
unsubscribeTriggers match {
case `messageBody` => true
case _ => false
}
}