I have to find all matches in a string that contains predefined tokens (AB- or BCC- or CDD-) or [A-Z]{2,4}-. Predefined tokens have a highest priority. I mean:
regex.findAllIn("XBCC-").toList
must always return List(BCC-), not List(XBCC-)
but:
regex.findAllIn("XTEST-").toList
must return List(TEST-)
I try something like that:
val regex = "((AB|BCC|CDD)|[A-Z]{2,4})-".r
But it doesn't work properly.