Class: Regexp

Inherits:
Object show all
Defined in:
lib/ronin/extensions/regexp.rb

Constant Summary collapse

MAC =

Regular expression for finding MAC addresses in text

/[0-9a-fA-F]{2}(?::[0-9a-fA-F]{2}){5}/
IPv4 =

A regular expression for matching IPv4 Addresses.

/[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}/
IPv6 =

A regular expression for matching IPv6 Addresses.

/:(:[0-9a-f]{1,4}){1,7}|([0-9a-f]{1,4}::?){1,7}[0-9a-f]{1,4}(:#{IPv4})?/
IP =

A regular expression for matching IP Addresses.

/#{IPv4}|#{IPv6}/
HOST_NAME =

Regular expression used to find host-names in text

/(?:[a-zA-Z0-9]+(?:[_-][a-zA-Z0-9]+)*\.)+(?:#{union(Resolv::TLDS)})/
USER_NAME =

Regular expression to match a word in the username of an email address

/[A-Za-z](?:[A-Za-z0-9]+[\._-])*[A-Za-z0-9]+/
EMAIL_ADDR =

Regular expression to find email addresses in text

/#{USER_NAME}(?:\.#{USER_NAME})*\@#{HOST_NAME}/