Skip to content

Instantly share code, notes, and snippets.

@thisivan
Created February 10, 2009 03:28
Show Gist options
  • Save thisivan/61212 to your computer and use it in GitHub Desktop.
Save thisivan/61212 to your computer and use it in GitHub Desktop.
Commonly used regular expressions in Ruby
# Base64
/^[0-9a-zA-Z+\/]+[=]{0,2}$/.match("SGVsbG8gV29ybGQh")
=> #<MatchData "SGVsbG8gV29ybGQh">
# R.F.C. (Méx)
/[A-Z]{3,4}[0-9]{6}[0-9A-Z]{3}/.match("ICS0707315S4")
=> #<MatchData "ICS0707315S4">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment