Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

need help with some sort of strip_bbcode modifier

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
wildcard
Smarty n00b


Joined: 05 Apr 2004
Posts: 2

PostPosted: Tue Apr 06, 2004 12:04 am    Post subject: need help with some sort of strip_bbcode modifier Reply with quote

I've tried some stuff to make a modifier that would work like the 'strip_tags' modifier for BBcode, but nothing seems to be working for me.

any suggestions on how to make this work?

i figure it'll use the preg_replace PHP function kinda like this

return preg_replace('$pattern', '', $string);

but i cant figure out the proper format for $pattern

all i want to do is get rid of any bbcode syntax (i.e. [b], [/b], [i], etc...) for a block of text so i can show an un-formatted portion of a bbcode formatted article on the main page.
Back to top
View user's profile Send private message
atu
Smarty Regular


Joined: 18 Apr 2003
Posts: 51
Location: Luxembourg

PostPosted: Tue Apr 06, 2004 10:48 am    Post subject: Reply with quote

Try this.

Code:

preg_replace("/\[|\]|\[[^\]]*\]/","",$string);
Back to top
View user's profile Send private message Visit poster's website
wildcard
Smarty n00b


Joined: 05 Apr 2004
Posts: 2

PostPosted: Thu Apr 08, 2004 1:47 am    Post subject: Reply with quote

[quote="atu"]Try this.

[code]
preg_replace("/\[|\]|\[[^\]]*\]/","",$string);
[/code][/quote]

Close! that got rid of the square brackets, but it didnt get rid of the stuff inside... so instead of [b] ... [/b], it showed b ... /b

i want it to remove the square brackets AND everything in them...
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP