Skip to content

Instantly share code, notes, and snippets.

@Andrew8xx8
Created July 10, 2013 14:40
Show Gist options
  • Select an option

  • Save Andrew8xx8/5966861 to your computer and use it in GitHub Desktop.

Select an option

Save Andrew8xx8/5966861 to your computer and use it in GitHub Desktop.
Match Version in Ruby
program_name = "interactive-2.1.1"
matches = program_name.match(/(.*)-(\d+)\.(\d+)\.(\d+)/)
name, major, minor, tiny = matches[1..-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment