Skip to content

Instantly share code, notes, and snippets.

@gmas
Last active August 29, 2015 14:09
Show Gist options
  • Save gmas/c1331ed9655bccf3bf61 to your computer and use it in GitHub Desktop.
Save gmas/c1331ed9655bccf3bf61 to your computer and use it in GitHub Desktop.
#ruby 2.0.0
%r{(?!.*\.{2}).*\w@}.match('[email protected]')
#=> nil
#ruby 2.1.4 - DOES NOT WORK
%r{(?!.*\.{2}).*\w@}.match('[email protected]')
#=> #<MatchData ".abc@">
#ruby 2.1.4 anchored - WORKS:
%r{^(?!.*\.{2}).*\w@}x.match('[email protected]')
#=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment