Mh-3110 added a comment.

  @Xqt ,
  As the output of all these regex statements is to clean the title, why not to 
use the Replace() function with the characters to replace in an array?
  Something like this:
  
    def cleanUpTitle(title):
        forbidden_characters = [';', ',' ,':' , '<', '>', '[', ']', 
'_','&','#','%','?','!','^','$', '/', '\\']
        for e in forbidden_characters:
            if e in title:
                title = title.replace(e, '')
                title = re.sub(r'[ ]+', ' ', title)
        return title.strip().replace(' ','_')
  
  What do you think about this?

TASK DETAIL
  https://phabricator.wikimedia.org/T246874

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Mh-3110
Cc: Mh-3110, Aklapper, pywikibot-bugs-list, Xqt, Chaytanya, Zkhalido, Viztor, 
DannyS712, Wenyi, Kieubinhtb, Tks4Fish, Asad_Ali_Palijo, Lahi, Soteriaspace, 
JakeTheDeveloper, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, D3r1ck01, 
Altostratus, Avicennasis, MuhammadShuaib, Tmalhotra, SimmeD, mys_721tx, jayvdb, 
Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to