Posted by alanburke on December 11, 2008 at 3:12pm
Hi all,
I need to do a simple filter to remove some odd character that get imported into my nodes [bulk import].
The characters are
ºº
and I need to replace them with a
<br />.
I've built a little filter module, which will do the trick, but my regex skills are , well, non existent.
I've tried
<?php
$text = eregi('ºº','<br />',$text);
?>to no avail.
Can anybody help?
Alan

Comments
try this
<?php$text = preg_replace('/ºº/', '<br />', $text);
?>
No dice...
Hi John,
Thanks for the quick response.
No luck with that, I'm afraid.
I'm pretty sure the rest of the module is functioning.
If I try a simpler preg_replace [with a word in the text, for example], it seems to work fine.
For whatever reason, it doesn't 'see' those characters, and doesn't remove them.
Alan
Maybe a character set issue
Maybe a character set issue - are you saving your module file as UTF-8?
Hmm
Maybe that's the issue.
I'll look into it further.
We're in the presence of greatness!
Well done John,
My module file wasn't UTF-8 - it is now!
All good, thanks a million!
Alan
I can't tell, what are those
I can't tell, what are those characters?
No idea!
I don't even know what they're called myself!
Speed
The simpler str_replace function would be faster than a full regular expression assuming it can handle the character encoding issue.
Alan: one of these days
Alan: one of these days you'll get on IRC and understand what you are missing :p