I intend to replace all the strings starting as style=” having anything in-between and ending with ” . Am trying to use this call but it isn’t working:
preg_replace('/style="*"/', '', $feed[$x]['desc']);
It is replacing only style=” and leaving the rest intact e.g. for style=”border:1px solid red” am still getting border:1px solid red” after the replacement, which means that the * wildcard is wrong to be used here.
How can I indicate that there can be anything in-between “” then ?
Thanks in advance !
you obviously want everything except a quote character, so use
/style="[^"]*"/in regexes, the asterisk means “0 or more repetitions of the previous character”