Skip to content

Hello darkness my old friend. - mass removal of color macros.

Created by: d3athrow

I hate regex.

Regex fix color macro idiocy:
    match \color not surrounded by quotes
    (?!\")\\green(?!\")([^"\\]*(?:\\.[^"\\]*)*)

    replace \b with <b></b>
    \\b\s([^"\\]*(?:\\.[^"\\]*)*)
    world << "\red \b Caching Jukebox playlists..."


    \color -> span while removing \black
    \\color\s(.+? (?=\\black))?(\\black\s)?(.*)(")
    <span class='span'>\1\3</span>\4

    \color -> span removing black and ignoring escaped quotes
    \\red\s(.+? (?=\\black))?(\\black\s)?([^"\\]*(?:\\.[^"\\]*)*)
    var/dicks_oak = "\red Holy shit \black mother fucker im gonna use \"escaped quotes\" instead of \black apostrophes","\red cocks \black !"
    match 1
        1.  Holy shit
        2.  \black
        3.  mother fucker im gonna use \"escaped quotes\" instead of \black apostrophes
    Match 2
        1.  cocks
        2.  \black
        3.  !
    <span class='span'>\1\4</span>

    \color -> span, </span> at \black
    \\red\s(.+? (?=\\black))(\\black\s)([^"\\]*(?:\\.[^"\\]*)*)
    newtraitor << "\red <B>ATTENTION:</B> \black It is time to pay your debt to the Syndicate..."
    Match groups:
        1.  <B>ATTENTION:</B>
        2.  \black
        3.  It is time to pay your debt to the Syndicate...


    \\red\s(<B>)(.+? (?=\\black))(\\black\s)([^"\\]*(?:\\.[^"\\]*)*)(<\/B>)
    "\red <B>The [MM] \black bounces off of the portal!</B>","\red Something you are carrying seems to be unable to pass through the portal. Better drop it if you want to go through."
    Match groups:
        1.  <B>
        2.  The [MM]
        3.  \black
        4.  bounces off of the portal!
        5.  </B>

    \\red\s(<B>)([^"\\]*(?:\\.[^"\\]*)*)(<\/B>)(.+? (?=\\black))(\\black)
    U << "\red <B>ERROR</B>: 100113 \black UNABLE TO LOCATE HEAD GEAR\nABORTING..."
    Match groups:
        1.  <B>
        2.  ERROR
        3.  </B>
        4.  : 100113
        5.  \black
    \\red\s(.+)(<B>)([^"\\]*(?:\\.[^"\\]*)*)(<\/B>)([^"\\]*(?:\\.[^"\\]*)*)
    current << "\red <FONT size = 3><B>You have proved your devotion to revoltion! Yea are a head revolutionary now!</B></FONT>"
    Match groups:
        1.  <FONT size = 3>
        2.  <B>
        3.  You have proved your devotion to revoltion! Yea are a head revolutionary now!
        4.  </B>
        5.  </FONT>
    replace: <span class='danger'>\1\3\5</span> = current << "<span class='danger'><FONT size = 3>You have proved your devotion to revoltion! Yea are a head revolutionary now!</FONT></span>"

    (([\?\[\(\)\:\;]\s)</span>(</span>)*)(")[?!,]??(.+)(")
    fixes bad spans outside of a string.

Merge request reports