Replacing an empty paragraph using preg_replace, space not recognized
I need to change this:
<p> </p>
In it:
<p class="notmobile"> </p>
in line. It seems simple, but the following does not work:
$filecontent = preg_replace('/<p> <\/p>/', '<p class="notmobile"> </p>', $filecontent);
$filecontent = preg_replace('/^<p> <\/p>/', '<p class="notmobile"> </p>', $filecontent);
$filecontent = preg_replace('/<p>\s<\/p>/', '<p class="notmobile"> </p>', $filecontent);
$filecontent = preg_replace('/<p>\s+<\/p>/', '<p class="notmobile"> </p>', $filecontent);
$filecontent = str_replace('<p> </p>', '<p class="notmobile"> </p>', $filecontent);
To make sure I'm not losing my mind, I replaced it with xxx to turn it into yyy, which worked perfectly. I think the problem is that my space is not normal space, as the content is probably the character set for Windows iso-8859-1 or whatever (or it got messy because we converted it to utf- 8 somewhere along the line ..)
Copying and pasting an empty paragraph from chome / firefox didn't work either.
I'm a little stuck :( Thanks for the help!
Update: here is base64_output, AwMD is the string from 0s that I used to mark the beginning of the string p, as mentioned above.
AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA8L3A + DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA + wqA8L3A + DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA + wqA8L3A + DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA + wqA8L3A + DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA + wqA8L3A + DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA + YmFzZTY0ZW5jb2Rpbmc8L3A + PC9w
* update2: charater ord php: 194, 160 - , . WEIRD. *