Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter text in ASP.NET 1

Status
Not open for further replies.

NMDUC

Programmer
Mar 4, 2006
61
VN
Hi,
I would like to make a control which has a textbox. When the user submit the content in the textbox, there is something filtering the text to make sure if it does not contain any rude world. Is there any class in ASP.NET which can help me to do it? Please help me. Thank in advance.
 
Thank you. But is it efficient to filter a large text such as news? Are there any ways such as algorithms to solve it?
 
Thank you. So, can it work if I want to filter out a text which has many paragraphs?

And do you have any solution when there might be a lot of rude words I want to filter?
 
So, can it work if I want to filter out a text which has many paragraphs?
Yes
And do you have any solution when there might be a lot of rude words I want to filter?
That depends on what words you consider rude. You will have to create a RegEx expression for each one.
 
I am going to build a list of rude words in a text file or xml file and cache it in the memory. So, every time I want o use it, I retrieve it and use Regex to filter the text. Is it OK?
 
But is it efficient to filter a large text such as news?
I don't imagine it will be slow, but it's probably not as fast as using Regular Expressions. Also, I guess it depends on what you want to do when you find this word. Do you want to remove it, flag it, edit it?


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
I decide to use Regular Expressions. It is used to filter out the bad words in what user has typed.
 
I want to check if there is any bad words in what user typed. If there is, I will give a warning. Of course, the list of bad words is defined and stored in the memory or somewhere.
 
OK, in that case if you were still interested in the efficiency of each method, you could compare your function to this example and see if using Regular Expressions is indeed faster.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top