Link to home
Create AccountLog in
Avatar of n8dog
n8dog

asked on

String Filter...

i need to filter out swear words for my chat app...

anyone?

-n
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of n8dog
n8dog

ASKER

there a way to make that case sensitive without puttiing in all the various forms, and without making it all lower or upper case?

-n
Avatar of n8dog

ASKER

ah nevermind, i will just make them all lower case.

thanks man!

-n8D
you can try using preg_replace:

$swear_words = array('word1','word2');

$preg = '/('.implode('|', $swear_words).')/i';

$string = preg_replace($preg, '***', $string);

-r-
Avatar of n8dog

ASKER

u rock!
Avatar of n8dog

ASKER

dont suppose youve worked with the ActiveX embed fix?

-n
You mean for flash?

-r-
Avatar of n8dog

ASKER

yeah...i found the fix straight forward, but it wouldnt work for me.

thought id ask while you were on

-n
I know of it's existence but I haven't looked into it yet to be honest.

-r-
Avatar of n8dog

ASKER

no problem - well thanks for the assistance on that string replace

after 3 weeks of around the clock coding, my head is melting...

-n