I am receiving blobs of text from an IRC server, and the data is not always sent in a consistent format.
This is the format that I'm expecting.
:hey!hey.tmi.twitch.tv PRIVMSG #stream :message here\r\n
I've developed this regex pattern to match it:
:[^()]+![^()]+.tmi.twitch.tv PRIVMSG #[^()]+ :[^()]+\\r\\n
And I'm doing this to assign the matches into a list:
newlist = re.findall(':[^()]+![^()]+.tmi.twitch.tv PRIVMSG #[^()]+ :[^()]+\\r\\n',str(string))
But, for example, when the input is sent in duplicate (doesn't happen often, but does happen)
:hey!hey.tmi.twitch.tv PRIVMSG #stream :message here\r\n:otherhey!otherhey!tmi.twitch.tv PRIVMSG #otherstream :othermessage here\r\n
It matches the whole string.
SO!
I'm trying to combine this regex:
^[^PRIVMSG]*PRIVMSG[^PRIVMSG]*$
With the other one, so that the findall will return me every instance in the string that the full pattern is matched.
But the result is that I don't get any matches. What am I missing? Any help appreciated.