I have this regex: /(?:(?<=(?:style=["])).*)(line-height.*?)[;"]/i
$regex = '/(?:(?<=(?:style=["])).*)(line-height.*?)[;"]/i';
preg_replace("/(?:(?<=(?:style=[\"'])).*)(line-height.*?)[;\"]/i", "HELLO", $input);
This is the input:
<li><span style="line-height: 20.14399986267089px">500.00dkk</span></li>
<li style="color:red; line-height: 21.14399986267089px"></li>
I want to replace only the occurrences of "line-height: SOMENUMBERpx" with HELLO (It also has to preceded by the style tag): but I can not make it work correctly. Right now it replaces the line-height properties, but it also replace,: color:red, which I do not want.
This is the output I want:
<li><span style=HELLO>500.00dkk</span></li>
<li style="color:red; HELLO"></li>
Can anyone see what I am doing incorrectly?