Is it possible in Scala to do pattern matching with an operator?
I want to input a tuple, for example ("Hello World", +) or ("Good Afternoon", /) and do different actions for different operators, like:
mytuple match {
case (SomeRegex(str), +) => println(str + " the same")
case (SomeRegex(str), /) => println(str + " but different")
}
How can I correctly do this? I don't care what the operators do, I just want them as a kind of environment.
Maybe even passing the char +or / along is considered best practice, but I hardly believe it.