All pastes #1232965 Raw Edit

Miscellany

public python v1 · immutable
#1232965 ·published 2008-10-21 17:26 UTC
rendered paste body
M = re.search('\00314\[\[\00307(.*?)\00314\]\]\0034 (.*?)\00310 (.*?)\00302(.*?)\003 \0035\*\003 \00303(.*?)\003 \0035\*\003 (.*?)\00310(.*)\003', message)event = {}try:  event['target'] = M.group(1)  event['type'] = M.group(2)  event['diff'] = M.group(4)  event['editor'] = M.group(5)  event['change'] = M.group(6)  event['summary'] = M.group(7)except:  returnif event['target'].startswith('Special:Log/'):  if event['target'] == 'Special:Log/newusers':    U = re.match('created new account \00302(.*)\00310',event['summary'])      if U:        // U.group(1) is the new account, event['editor'] is the person creating it      else:        // event['editor'] is the new account  elif event['target'] == 'Special:Log/move':    mv = re.sub('\003\d{1,2}','',event['summary'])    mv = re.search('\[\[(.*?)\]\] (?:moved to|to) \[\[(.*?)\]\](.*)',mv)    if mv:      event['summary'] = mv.group(3)      // mv.group(1) is the source, and mv.group(2) is the destination