Skip to content

Instantly share code, notes, and snippets.

@2m
Created November 6, 2014 13:21
Show Gist options
  • Save 2m/56d8af00aa9eba5daa37 to your computer and use it in GitHub Desktop.
Save 2m/56d8af00aa9eba5daa37 to your computer and use it in GitHub Desktop.
Scala regexp unapply
scala> val YearMonth = "([0-9]+)-([0-9]+)".r
YearMonth: scala.util.matching.Regex = ([0-9]+)-([0-9]+)
scala> val YearMonth(year, month) = "2014-11"
year: String = 2014
month: String = 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment