I have a user input form where the user is allowed to use HTML, such as div
, span
, etc.
I would like to clean the input only if a user happens to put in a div
with a style="width:"
that is over the site width (which in this case is 800px.)
So I wanted to do a preg_replace
searching for div style="width:"
only when width is greater than 800px.
I already have all other fixes in place for spans
, div width=""
, etc. but the preg_replace
on the div style="width:"
where the width is only changed if it is greater than 800 (such as 1500px, 2000px, 801px) eludes me - I cannot get it to work.
Is there any way to achieve this?