PDA

View Full Version : ereg_replace question


Kirk Y
17 Mar 2007, 03:37
I'm in need of some quick ereg_replace help. I'm trying to strip specific characters from a string, namely an asterisk and the whitespace immediately following/preceding it.

Typical string: * Forum *
I want: Forum

This is what I've got thus far:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Dismounted
17 Mar 2007, 04:45
Use preg and not ereg, preg is much faster.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Kirk Y
17 Mar 2007, 05:12
Thanks for the assist, but now it seems that it killed the script, lol. It should be displaying all forums - but it's only displaying one; although that one forum does have its asterisks stripped. :p

Dismounted
17 Mar 2007, 05:18
What's contained in the string '$forum[title_clean]'?

Kirk Y
17 Mar 2007, 05:24
The cleaned (done by vB default) title of each forum that's being output in the archive.

calorie
17 Mar 2007, 05:30
Try trim to avoid making a regexp for '** * for*um* ** *' type things.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Kirk Y
17 Mar 2007, 05:35
Try trim to avoid making a regexp for '** * for*um* ** *' type things.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Ah, that worked perfect Calorie - thanks! They're called asterisks by the way. :p