![]() |
ereg_replace question
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:
$forum[title_clean] = ereg_replace("[^A-Za-z0-9]", "", $forum[title_clean]); |
Use preg and not ereg, preg is much faster.
PHP Code:
|
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
|
What's contained in the string '$forum[title_clean]'?
|
The cleaned (done by vB default) title of each forum that's being output in the archive.
|
Try trim to avoid making a regexp for '** * for*um* ** *' type things.
Code:
$forum['title_clean'] = trim($forum['title_clean'], '* '); |
Quote:
|
All times are GMT. The time now is 05:40 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|