module Regexp::Irc
We start with some IRC related regular expressions, used to match Irc::User
nicks and users and Irc::Channel
names
For each of them we define two versions of the regular expression:
-
a generic one, which should match for any server but may turn out to match more than a specific server would accept
-
an RFC-compliant matcher
Constants
- BANG_AT
Things such has the BIP proxy send invalid nicks in a complete netmask, so we want to match this, rather: this matches either a compliant nick or a a string with a very generic nick, a very generic hostname after an @ sign, and an optional user after a !
- CHAN_ANY
- CHAN_FIRST
Channel-name-matching regexps
- CHAN_LIST
Match a list of channel anmes separated by optional commas, whitespace and optionally the word “and”
- CHAN_SAFE
- GEN_CHAN
- GEN_HOST
- GEN_HOST_EXT
Sadly, different networks have different, RFC-breaking ways of cloaking the actually host address: see above for an example to handle FreeNode. Another example would be Azzurra, which also inserts a “=” in the cloacked host. So let’s just not care about this and go with the simplest thing:
- GEN_NICK
- GEN_USER
- GEN_USER_ID
User-matching
Regexp
- HOSTADDR
- HOSTNAME
- HOSTNAME_COMPONENT
Host-matching regexps
- IN_CHAN
Match “in channel” or “on channel” and/or “in private” (optionally shortened to “in pvt”), returning the channel name or the word ‘private’ or ‘pvt’ as capture
- IN_CHAN_LIST
- IN_CHAN_LIST_PVT
- IN_CHAN_LIST_PVT_SFX
- IN_CHAN_LIST_SFX
As above, but with channel lists
- IN_CHAN_PVT
- NICK_ANY
- NICK_FIRST
- NICK_LIST
Match a list of nicknames separated by optional commas, whitespace and optionally the word “and”
- RFC_CHAN
- RFC_NICK
- SPECIAL_CHAR
Nick-matching regexps
- USER_CHAR