Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 22nd, 2012  |  syntax: None  |  size: 0.25 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/env ruby
  2.  
  3. url = ('http://www.tvrage.com/NCIS/episodes/720720/')
  4.  
  5.  
  6. if url.match(/(http:\/\/|#{nil})(.+)\/(.+?)\/episodes\/(\d+)(\/?)$/) then
  7.  
  8.   puts 'Domain = ' + $2
  9.   puts 'Show = ' + $3
  10.   puts 'Number = ' + $4
  11.   puts "Found"
  12.  
  13. end
clone this paste RAW Paste Data