The Regex class is provided in scala to define regular expressions
To construct a Regex object, you can use the new Regex method, or directly use the r method of the String class.
val regex1 = new Regex("""Regular expression""")
val regex2 = """Regular expression""".r //It is recommended to use three double quotation marks to represent the regular expression, otherwise you have to escape the backslash in the regular expression
findAllMatchIn method
Use the findAllMatchIn method to get all the strings matched by the regular
The regularity itself is a very complex content, there are many rules, here you can understand
Learn the API, not how to write regular expressions