473,698 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function to filter cursed words

Hi,

I was asked to create a function to detect cursed words in user's input and
reject user's input if found, does anybody know existing codes I can use?

TIA
Jan 24 '06 #1
5 1647
Try this - very effective algorithm to detect words in text
http://www.codeproject.com/useritems/ahocorasick.asp

"John" <so*****@micros oft.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

I was asked to create a function to detect cursed words in user's input
and reject user's input if found, does anybody know existing codes I can
use?

TIA

Jan 24 '06 #2
Well, the way I do input masking for TextBoxes in a C# app is to use
the KeyPress event. This will be a little more difficult to catch
entire words. Basically, if we have.

TextBox someText = new TextBox();
someText.KeyPre ss += new KeyPressEventHa ndler(keyPressF unc);
private void keyPressFunc(ob ject sender, KeyPressEventAr gs e)
{
//here you can get the key that was pressed through e.KeyChar and
if you don't want that character to get processed
//use the following line of code

e.Handled = true;

//this will keep the textBox from processing the keystroke
}

This is how I keep users from doing things like entering text into
number only fields. It would take some modification to store key
strokes and compare them to a library of curse words. I hope this helps.

Jan 24 '06 #3
On Tue, 24 Jan 2006 13:19:58 -0800, "John" <so*****@micros oft.com>
wrote:
Hi,

I was asked to create a function to detect cursed words in user's input and
reject user's input if found, does anybody know existing codes I can use?

TIA

Be careful to look carefully at *exactly* how the filter works. There
is a town in England called Scunthorpe whose residents are all to
aware of the effect of sloppily programmed filters. That is not the
only example, but it does illustrate a real problem.

rossum
--

The ultimate truth is that there is no ultimate truth
Jan 24 '06 #4
Yes, and let us not forget the town of Penistone, either.

I've read that even Google's child-safe content filtering technology
does dumb stuff like this. It's not as easy as it looks to get it right.

--Bob

rossum wrote:
Be careful to look carefully at *exactly* how the filter works. There
is a town in England called Scunthorpe whose residents are all to
aware of the effect of sloppily programmed filters. That is not the
only example, but it does illustrate a real problem.

rossum

Jan 28 '06 #5
And even if correctly implemented it can usually be easily side stepped by
somebody determined to cause offence - symbols, deliberate typos (french
connection UK for instance), additional spacing, etc - all of which can
leave the intent (and offence) without any cursed words...

Marc
Jan 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1667
by: Nathan Bloomfield | last post by:
I am using the code below to filter a report: Private Sub Set_Filter_Click() If Me! And Me! <> "" Then If Application.CurrentProject.AllReports("rptDailyOutput").IsLoaded Then DoCmd.Close acReport, "rptDailyOutput" DoCmd.OpenReport "rptDailyOutput", acViewPreview, , " Between #" & Format(Me!, "mm/dd/yy") & "# and #" & Format(Me!, "mm/dd/yy") & "#"
4
1807
by: Thomas | last post by:
I want to be able to implement a filter that manipulates the output from the server... Maybe replacing some words, or highlighting a search string, or some other fancy feature... I want to make this code reusable to all my applications, and by making this as a HttpModule I can implement this feature on existing .Net applications by editing the we.config and nothing else... My problem is that that I can't get this to work.
5
2252
by: Andy | last post by:
Sigh... working on it for whole day and got no idea... Basically I want to have a bitmask filtering function, I will throw in 3 parameters: bitMaskValue - current bitmask value filterValue - the value I want to see if its exist in "bitMaskValue" BiggestValue - the maximum individual value can be exist And I want it just to return true if the value exist, or false if not
21
2327
by: Dmitry Anikin | last post by:
I mean, it's very convenient when default parameters can be in any position, like def a_func(x = 2, y = 1, z): ... (that defaults must go last is really a C++ quirk which is needed for overload resolution, isn't it?) and when calling, just omit parameter when you want to use defaults: a_func(, , 3)
3
1452
by: bay_dar | last post by:
Hi my dirty word filter function has a problem, it is over restrictive. For instance the word "analysis" is ok, but the word "anal" is not. Any advice? code below: Public Function IsHaveDirtyWord(ByVal a_str_Text As String) As String Dim badWordFound As String badWordFound = ""
2
1541
by: ChianHsieh | last post by:
Hi, I face some problem that I want to filter the all words in HTML. Example: Before Filter: <div id="pp"hello man <br/Thank's for your answer. </div> After Filter:
2
1907
by: amir | last post by:
How can I filter my database in Multiple way, I mean that I wana to filter st. like this: sm* *th* *er Please Help me on this matter Amir
3
1992
by: Mr 200 | last post by:
Hi all ive just recently started learning java and was happy to find a forum that may be able to give me a little assistance. I have been set an excersize to create a filter processor that relays information between several filters to give a result. I have created one of the filters already, however i need the filter processor working in order to test wether the filter i have done works correctly. However im not completely sure where to...
6
1889
by: cmartin1986 | last post by:
What I'm trying to do is add a button to my "front" page which will open a form and filter excluding the words "installed" and "na" in the field declared by my combo box. I've pretty much got it figured out except I can get it to filter out more than one of the two words. Here is what I've got: Private Sub Command82_Click() On Error GoTo Err_Status_Click Dim stdocname As String Dim stlinkcriteria As String stdocname =...
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.