-null- Posted June 8, 2009 Share Posted June 8, 2009 I'd like to be able to allow only certain BBCodes in my forum. To do so I am trying to use regular expressions to parse all the bbcode and removing the unwanted codes. So far I have the expression that matches any simple bbcode #\[(.+?)\](.+?)\[/\\1\]#is However I'm not sure how to exclude the characters I want to keep (b, i, u a and s) from this expression. Is it possible to exclude characters with a dot match. Quote Link to comment https://forums.phpfreaks.com/topic/161365-excluding-certain-characters-when-using-the-period/ Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 You wouldn't use the dot character in this case, you'd just say like 'any character except these': [^buias]+ Quote Link to comment https://forums.phpfreaks.com/topic/161365-excluding-certain-characters-when-using-the-period/#findComment-851522 Share on other sites More sharing options...
-null- Posted June 9, 2009 Author Share Posted June 9, 2009 Thanks That works for single character tags and I managed to work out how to match tags longer than one character as well. Quote Link to comment https://forums.phpfreaks.com/topic/161365-excluding-certain-characters-when-using-the-period/#findComment-852287 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.