Scala Newbie I have a text file that has lines like-
HP,20180720
UPE,20180720
MP,20180720
and so on.. In my scala program, I have captured the pattern as:
val pattern = "([A-Z]{2}[A-Z]?]),([0-9]{4})([0-9]{2})([0-9]{2})".r
val pattern(circle,year,month,day) = line
Here line is the iterator for the text file where each iteration is a line from the file like - MP,20180720
Now, in REPL I can see that the variable pattern has the required values but how can I unpack them, access them or store it in a separate variable??
according to this article :https://alvinalexander.com/scala/how-to-extract-parts-strings-match-regular-expression-regex-scala