Created
September 4, 2009 03:05
-
-
Save darkhelmet/180705 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
# this fails matching /2009/04/30/borland-c++-builder-5-how-i-hate-thee | |
get %r|^/\d{4}/\d{2}/\d{2}/[\w\d\-+]+$| do |match| | |
p match | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
link = '/2009/04/30/borland-c++-builder-5-how-i-hate-thee' | |
regex = %r|^/\d{4}/\d{2}/\d{2}/[\w\d\-+]+$| | |
# this works | |
p link =~ regex | |
p link.match(regex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment