I'm a bit at a loss. The below regex works as expected:
$src_data = preg_replace("/"(.+?)"/", "<span class=\"src_att\">$0</span>", $src_data);
$src_data = preg_replace("/'(.+?)'/", "<span class=\"src_att\">$0</span>", $src_data);
However, this one fails to close the span:
$src_data = preg_replace("/\/\/(.+?)
/", "<span class=\"src_com\">$0</span>", $src_data);
Sure enough it's something trivia but I fail to see the error. Any help appreciated, thanks.
EDIT:
$src_data may be anything, e.g. a single line or multiple lines. The below is an example with single quotes - awhich works as expected:
$ds_type = array ('Bytes', 'KiB', 'MiB', 'GiB', 'TiB');
Albeit, trying to match a comment fails to add the closing span:
//** this is just a comment
The output is renderd fine, but obviously the mark-up is invalid due to the missing span.