Skip to content

Instantly share code, notes, and snippets.

@JeremyHutchings
Created January 27, 2015 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeremyHutchings/d27fd0ea06f570ea1259 to your computer and use it in GitHub Desktop.
Save JeremyHutchings/d27fd0ea06f570ea1259 to your computer and use it in GitHub Desktop.
val input = "Enjoying this apple 3.14159 times today"
//input: String = Enjoying this apple 3.14159 times today
val pattern = """.* apple ([\d.]+) times .*""".r
//pattern: scala.util.matching.Regex = .* apple ([\d.]+) times .*
val pattern(amountText) = input
//amountText: String = 3.14159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment