Today, I Learned...

by Justin Campbell

< All

Use %r for Ruby regular expressions, to avoid having to escape forward-slashes:

"http://domain.tld".match /^http:\/\// # => true
"http://domain.tld".match %r{^http://} # => true

Thanks to @joshsusser

November 1st, 2012