How To Filter Invalid(vulgar) words in JSP?
when data was entered to a textbox it must not contain vulgar or bad words.The event is processed before data is saved and posted.
Do I need to specify each word or there are some shortcuts for it?
Can you give me a concrete example..tnx a lot!!!

Recommended Answers

All 6 Replies

usually you have a list of words and check each word against that list.
There are more advanced systems that do full lexical analysis to also take context into account but you're not ready for those.

can you please giv me a brief example?tnx...

If you happy with JavaScript why not...

>>Visit this site, it really fits well to my needs:
Ok, so it won't accept the word "bloody" but it will accept "f***k". Some crappy filter that is :) bloody is not a naughty word but the other is.

Well you need to maintain the array of rude words, they provided only 3 words in their example

var swear_words_arr=new Array("bloody","war","terror");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.