citricsquid Posted April 30, 2009 Share Posted April 30, 2009 Hi guys, I've built my own mini BBCode to use with an application, using preg_replace to create the replacements of [][/] that match my array of BBCode samples. I also validate inputs, checking that they're not empty or have too little characters. However, I have hit a problem: If a does something like [ b ][ / b ] (no spaces) it counts towards the total character count, even though it's output is nothing, therefore even if the min character count is 100, just having 20 [ b ][ / b ]'s would go over that and still be blank. How can I remove any BBCode from my string, where it contains nothing inside? I'm thinking I'll need to use preg_replace, like, trim all whitespace from the string and check if [ b ][ / b ] (remove spaces) is there, if it is, remove it. Is this the correct method, or have I made an oversight? Quote Link to comment https://forums.phpfreaks.com/topic/156253-php-bbcode-checking-for-blank-posts/ Share on other sites More sharing options...
ignace Posted April 30, 2009 Share Posted April 30, 2009 Why write it? http://be.php.net/bbcode Quote Link to comment https://forums.phpfreaks.com/topic/156253-php-bbcode-checking-for-blank-posts/#findComment-822757 Share on other sites More sharing options...
citricsquid Posted April 30, 2009 Author Share Posted April 30, 2009 Why write it? http://be.php.net/bbcode I've looked at that, but after installing it it doesn't work. Dunno what the problem is, I'm probably doing something wrong, but right now I just want something that works and this pretty much does, so I'm not changing. Quote Link to comment https://forums.phpfreaks.com/topic/156253-php-bbcode-checking-for-blank-posts/#findComment-823023 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.