In Scala I am trying to detemine the number of types a particular match is found (and it can occur several times in the same string). Namely, something that is of form "##/nnn-#" where # is a number 0-9
and n is a letter A-Za-z
and - is a hiphen and / is a forward slash.
You mean something like this?
scala> val reg = "[0-9]{2}/[a-zA-Z]{3}-[0-9]".r
scala> val str = "12/abc-2 abcd 55/bar-2 foo bar"
scala> reg.findAllIn(str).length
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.