Class | Regexp |
In: |
lib/rbot/core/utils/extends.rb
lib/rbot/irc.rb lib/rbot/messagemapper.rb |
Parent: | Object |
First of all we add a method to the Regexp class
IN_ON | = | /in|on/ | ||
DIGITS | = | /\d+/ | We start with some general-purpose ones which will be used in the Irc module too, but are useful regardless | |
HEX_DIGIT | = | /[0-9A-Fa-f]/ | ||
HEX_DIGITS | = | /#{HEX_DIGIT}+/ | ||
HEX_OCTET | = | /#{HEX_DIGIT}#{HEX_DIGIT}?/ | ||
DEC_OCTET | = | /[01]?\d?\d|2[0-4]\d|25[0-5]/ | ||
DEC_IP_ADDR | = | /#{DEC_OCTET}\.#{DEC_OCTET}\.#{DEC_OCTET}\.#{DEC_OCTET}/ | ||
HEX_IP_ADDR | = | /#{HEX_OCTET}\.#{HEX_OCTET}\.#{HEX_OCTET}\.#{HEX_OCTET}/ | ||
IP_ADDR | = | /#{DEC_IP_ADDR}|#{HEX_IP_ADDR}/ | ||
HEX_16BIT | = | /#{HEX_DIGIT}{1,4}/ | IPv6, from Resolv::IPv6, without the \A..\z anchors | |
IP6_8Hex | = | /(?:#{HEX_16BIT}:){7}#{HEX_16BIT}/ | ||
IP6_CompressedHex | = | /((?:#{HEX_16BIT}(?::#{HEX_16BIT})*)?)::((?:#{HEX_16BIT}(?::#{HEX_16BIT})*)?)/ | ||
IP6_6Hex4Dec | = | /((?:#{HEX_16BIT}:){6,6})#{DEC_IP_ADDR}/ | ||
IP6_CompressedHex4Dec | = | /((?:#{HEX_16BIT}(?::#{HEX_16BIT})*)?)::((?:#{HEX_16BIT}:)*)#{DEC_IP_ADDR}/ | ||
IP6_ADDR | = | /(?:#{IP6_8Hex})|(?:#{IP6_CompressedHex})|(?:#{IP6_6Hex4Dec})|(?:#{IP6_CompressedHex4Dec})/ |
A method to build a regexp that matches a list of something separated by optional commas and/or the word "and", an optionally repeated prefix, and whitespace.
a Regexp has captures when its source has open parenthesis which are preceded by an even number of slashes and not followed by a question mark