Posted By

oso96_2000 on 05/19/08


Tagged

regex replace censor


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

romanos
hamiltonmascioli


Censor bad words with regexp


 / Published in: PHP
 

URL: http://osiux.ws/2008/04/29/filtro-de-palabras-en-php/

This function uses the power of regexp to check if some bad word are on the text, also offers the posibility to change those word for something else. Examples:\r\n\r\n$texto = \'fuck off!\';\r\nfiltrado($texto); returns true since a bad word has been found on the text\r\nfiltrado($texto, \'[censored]\'); //returns [censored] off!\r\n\r\nAnd because regexp, this will work with something like \"fck off!\". You can see a more detailed example here:\r\nhttp://www.otaku-anime.com/varios/filtro.php -- Example\r\nhttp://www.otaku-anime.com/varios/filtro.php?source -- Source code of the example

Report this snippet  

You need to login to post a comment.