Skip to content

Instantly share code, notes, and snippets.

@SeanRoberts
Created May 11, 2011 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SeanRoberts/966479 to your computer and use it in GitHub Desktop.
Save SeanRoberts/966479 to your computer and use it in GitHub Desktop.
>> regex = %r{^[A-Za-z]?[0-9]+$}
>> "11209520".match(regex)
=> #<MatchData "11209520">
>> "A11209520".match(regex)
=> #<MatchData "A11209520">
>> "AA11209520".match(regex)
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment