i am trying to parse lines from a log and output html and wanted the color codes to work.

i found this class online that should work but it doesn't color anything nor does it remove the control codes. it is supposed to replace the control codes with equivalent html but completely ignores it outputting 

```
[0;35;22m/plugins: [0;37;1mGets a list of plugins running on the server[m

```

here is the class

```
<?php

 function bashColortoHtml($string) {
    $ret = false;

    if(!empty($string)) {
        $_colorPattern = array(
            '/\\033\[1;33m(.*?)\\033\[0m/s',
            '/\\033\[0;31m(.*?)\\033\[0m/s',
            '/\\033\[0;34m(.*?)\\033\[0m/s',
            '/\\033\[0;36m(.*?)\\033\[0m/s',
            '/\\033\[0;35m(.*?)\\033\[0m/s',
            '/\\033\[0;33m(.*?)\\033\[0m/s',
            '/\\033\[1;37m(.*?)\\033\[0m/s',
            '/\\033\[0;30m(.*?)\\033\[0m/s',
            '/\\033\[0;32m(.*?)\\033\[0m/s'
        );
        $_colorReplace = array(
            '<span class="yellow">$1</span>',
            '<span class="red">$1</span>',
            '<span class="blue">$1</span>',
            '<span class="cyan">$1</span>',
            '<span class="purple">$1</span>',
            '<span class="brown">$1</span>',
            '<span class="white">$1</span>',
            '<span class="black">$1</span>',
            '<span class="green">$1</span>'
        );

        $ret = preg_replace($_colorPattern, $_colorReplace, $string);
    }

    return $ret;
}
?>
<?php
$output = bashColortoHtml('[0;35;22m/plugins: [0;37;1mGets a list of plugins running on the server[m');
echo $output;
?>

```

what is the issue with this class and/or is there a better way of doing this with php