Thats beacue in your REGEX (and im no expert!) you are replacing > with '<span style="color:green">text</span>' and not '<span style="color:green">/>*/</span>'
What i mean to say you need to replace >* (so > and wildcard) with >* but wrapped in the span, as it is your replacing it with the word "text" in green
Have you tried:
PHP Code:
$replacement = '<span style="color:green">$pattern</span>';
or some variation with or without more single quotes?