Opered-Up Regex - split nickname and hostmask #14

Open
opened 2021-08-31 16:37:07 +02:00 by Georg · 0 comments
Owner
    if 'OPER' in text and 'Client opered up' in text:
        operregex = "^-OPER- Client opered up \[(.*)\, \ (.*)\]$"
        couple = re.match(operregex, text)
        hostmask = couple.group(1)
        oper = couple.group(2)

        print(couple)

        DictFromSnotice = {'notice': 'opered', 'hostmask': hostmask, 'oper': oper}
        repl = f"\x02\x1FNOTICE:\x0F [{hostmask}] opered up as [{oper}]."

        self._sendSnotice(irc, msg, repl)
        
      @pratyush - the regex should split 
      
      -OPER- Client opered up [test3!~u@ac2zt762wf6qe.irc, testadmin]
      
      into 
      hostmask = test3!~u@ac2zt762wf6qe.irc
      and
      oper = testadmin
      
      Can you help?
      
      
      ```
      

@pratyush

if 'OPER' in text and 'Client opered up' in text: operregex = "^-OPER- Client opered up \[(.*)\, \ (.*)\]$" couple = re.match(operregex, text) hostmask = couple.group(1) oper = couple.group(2) print(couple) DictFromSnotice = {'notice': 'opered', 'hostmask': hostmask, 'oper': oper} repl = f"\x02\x1FNOTICE:\x0F [{hostmask}] opered up as [{oper}]." self._sendSnotice(irc, msg, repl) @pratyush - the regex should split -OPER- Client opered up [test3!~u@ac2zt762wf6qe.irc, testadmin] into hostmask = test3!~u@ac2zt762wf6qe.irc and oper = testadmin Can you help? ``` @pratyush
Georg added the
Type: Bug
label 2021-08-31 16:37:49 +02:00
pratyush was assigned by Georg 2021-08-31 16:37:55 +02:00
Sign in to join this conversation.
No description provided.