I need to change this:
<p> </p>
Into this:
<p class="notmobile"> </p>
on a string. Seems simple, but the following don't 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 wasn't going crazy, I did a replace on xxx to turn it into yyy which worked just fine. I think the problem is my space isn't a normal space as the content is probably that windows character set iso-8859-1 or whatever it is (or it's got confused because we've converted that to utf-8 somewhere along the line..)
Copying and pasting the empty paragraph from chome/firefox didn't work either.
I'm a bit stuck :( Thanks for helping!
Update: Here's the base64_output, AwMD is a string of 0s which I used to mark the beginning of a string of p's as above.
AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA8L3A+DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA+wqA8L3A+DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA+wqA8L3A+DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA+wqA8L3A+DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA+wqA8L3A+DQo8cD7CoDwvcD4NCjxwPsKgPC9wPg0KPHA+YmFzZTY0ZW5jb2Rpbmc8L3A+PC9w
*update2: I've found the charater ord values in php are: 194 followed by 160 - eg it's two characters. WEIRD. *
+into*and add the/imsflags. Otherwise there is something else in your source text. (Existing attributes in the<p>tags for example?)ord(). Or your editor might support printing the hex value of a character, e.g. inVim, hover over the letter and typega./\p{Z}+/uto kill it.