import re # Strip bbcode coming into ircBridge from site chatbox def strip_bbcode(text): # Matches BBCode tags like [tag], [tag=value], [/tag] return re.sub(r'\[(\/?)?(color|size|pre|img|url|b|i|u|style)(=[^\]]+)?\]', '', text, flags=re.IGNORECASE) # Extract username from an IRC line def parse_username(line): if line.startswith(":"): return line[1:].split("!")[0] return "UnknownUser"