Skip to content

Instantly share code, notes, and snippets.

@neumino
Created September 18, 2014 21:31
Show Gist options
  • Save neumino/e04494837b430c7a565c to your computer and use it in GitHub Desktop.
Save neumino/e04494837b430c7a565c to your computer and use it in GitHub Desktop.
// Suppose that there are 10 digits somewhere in the string
// Extract the 10 digits, and concatenate them
r.add(r.args(
r.expr('(123) 456-7890').match('^[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*$')("groups")("str")
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment