LScarpinati

Ruby shortcuts

Jul 20th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.19 KB | None | 0 0
  1. # Extracting emails
  2. r = Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/)
  3. addrs = <some text>.scan(r)
  4.  
  5. # Extract IPs
  6. ips = entr.scan(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)
Advertisement
Add Comment
Please, Sign In to add comment