You haven’t described your requirements very well. It looks like a simple substring formula is all you need.
val str = "[CS]v1|<bunch of alpha numberic text>[CE]"
val extract = str.substring(7, str.length-4)
But if you really want to use regex this might do.
val str = "[CS]v1|<bunch of alpha numberic text>[CE]"
val extractor = "[^|]+\\|(.*)\\[..]".r
val extract = str match {
case extractor(s) => s
case _ => ""
}
2
solved Extract text using regular expression between keywords