I've below scala function.
def getMatchesFor(input: String, matchId: String): List[String] = {
val regex = s"""${matchId}_\w*""".r
(regex findAllIn input).toList
}
What is the expectation of the function is
val input = "abc_1_1_1_0abc_1_0_1"
val result = getMatchesFor(input, "abc")
result should be List("abc_1_1_1_0", "abc_1_0_1")
I've tried so far val r = s"${matchId}_\\w*".r but it is not working as expected.
How can I fix this issue?
abc_1_xyz?abc_1_xyz. Please let me know if you have any more questions