|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
wildcard Smarty n00b
Joined: 05 Apr 2004 Posts: 2
|
Posted: Tue Apr 06, 2004 12:04 am Post subject: need help with some sort of strip_bbcode modifier |
|
|
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 |
|
atu Smarty Regular
Joined: 18 Apr 2003 Posts: 51 Location: Luxembourg
|
Posted: Tue Apr 06, 2004 10:48 am Post subject: |
|
|
Try this.
Code: |
preg_replace("/\[|\]|\[[^\]]*\]/","",$string);
|
|
|
Back to top |
|
wildcard Smarty n00b
Joined: 05 Apr 2004 Posts: 2
|
Posted: Thu Apr 08, 2004 1:47 am Post subject: |
|
|
[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 |
|
|
|
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
|