Skip to content

Instantly share code, notes, and snippets.

@bartolsthoorn
Created October 6, 2012 16:09
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 bartolsthoorn/5099f1a13d33f80d317c to your computer and use it in GitHub Desktop.
Save bartolsthoorn/5099f1a13d33f80d317c to your computer and use it in GitHub Desktop.
def first_match(regexp, subject)
matches = subject.scan(regexp)
return (matches[0] ? matches[0][0] : '')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment