I just can't figure this out, for some reason this:
$string = "#mainparent {
position: relative;
top: 100px;
left: 100px;
width:4994px;
}";
$elementwidth = "88";
$re1='(.*?)'; # Non-greedy match on filler
$re2='(mainparent)'; # Word 1
$re3='(.*)'; # Non-greedy match on filler
$re4='(width:)';
$re5='(.*)'; # Word 2
$re6='(;)'; # Any Single Character 1
$pattern="/".$re1.$re2.$re3.$re4.$re5.$re6."/s";
$replacement= '$1'.'$2'.'$3'. '$4'. $element_width .'$6';
$return_string = preg_replace_component ($string, $pattern, $replacement );
#c}
echo $return_string; return;
output this (below), I can't understand why it is replacing the "width:" based on the way I have set it up.. any advice is appreciated
#mainparent { position: relative; top: 100px; left: 100px; 88; }