DJTim666 Posted September 22, 2007 Share Posted September 22, 2007 I created a function that allows me to filter words, add tags and some other stuff. But I realized that if someone messes up a tag and forget to add then everything after their post becomes bolded. Is there anyway to stop this from happening? Quote Link to comment https://forums.phpfreaks.com/topic/70262-function/ Share on other sites More sharing options...
rarebit Posted September 22, 2007 Share Posted September 22, 2007 I don't know of a function that already exists, however if you count (grep) all occurrences of opening and closing (or all (even)) and subtract from each other, if answer equals 0, then cool for school! Quote Link to comment https://forums.phpfreaks.com/topic/70262-function/#findComment-352871 Share on other sites More sharing options...
DJTim666 Posted September 22, 2007 Author Share Posted September 22, 2007 uhh i didn't notice you couldn't see the tags, but they are [ b ] and [ /b ] And how would I counnt all occurances of a tag? Quote Link to comment https://forums.phpfreaks.com/topic/70262-function/#findComment-352879 Share on other sites More sharing options...
rarebit Posted September 22, 2007 Share Posted September 22, 2007 Start here: http://uk3.php.net/manual/en/function.preg-grep.php Quote Link to comment https://forums.phpfreaks.com/topic/70262-function/#findComment-352882 Share on other sites More sharing options...
wildteen88 Posted September 22, 2007 Share Posted September 22, 2007 If you are using bbcodes (, etc.) then you should parse them as pairs. I guess at the moment you are using str_replace to parse into <b>. This is not very particle. The best way is to use regex for bbcode parsing. I would recommend you searching this forum for the term bbcode, best place to search is in the Regex help forum. There has been many posts about BBCode. Quote Link to comment https://forums.phpfreaks.com/topic/70262-function/#findComment-352897 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.