Skip to content

Instantly share code, notes, and snippets.

@michaelminter
Created May 30, 2014 16:56
Show Gist options
  • Save michaelminter/64f072de90b9af0b61fb to your computer and use it in GitHub Desktop.
Save michaelminter/64f072de90b9af0b61fb to your computer and use it in GitHub Desktop.
String extraction with RegEx -- replaces match
str = "GB is not Great Britain"
matches = str.match /(Great.*)/
matches[1]
# => "Great Britain"
str[/(Great.*)/, 1]
# => "Great Britain"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment