473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"Case Sensitive" Question

Hi,
This script is designed to remove foul language from a document, the
question is that it will only remove what is put into the array, these
words are in lowercase, now how can I have the script parse the document
in lowercase?
If foul words start with a cap or their in uppercase the script won't
remove them.
I tried putting .toLowerCase(); into different parts of the script and
it powered me off a few times. Any help is appreciated. Thanks Joe

PS: this is a basic version of the script:
http://web2jo.com/TBed/LangFilter.html

Jul 23 '05 #1
5 1698
Papajo wrote:
Hi,
This script is designed to remove foul language from a document, the
question is that it will only remove what is put into the array, these
words are in lowercase, now how can I have the script parse the document
in lowercase?
If foul words start with a cap or their in uppercase the script won't
remove them.
I tried putting .toLowerCase(); into different parts of the script and
it powered me off a few times. Any help is appreciated. Thanks Joe

PS: this is a basic version of the script:
http://web2jo.com/TBed/LangFilter.html

I think your whole approach is somewhat flawed, I would use regular
expressions to parse out objectionable words. As it is now, "assume"
becomes "---ume".

String.replace(/\bass\b/gi,"---").replace(/\bdamn?\b,"---") etc.

or you could loop through the banned words:
regex=new RegExp("\\b"+array[index]+"\\b","gi")
String.replace(regex,"---")
Mick
Jul 23 '05 #2
Lee
Papajo said:

Hi,
This script is designed to remove foul language from a document, the
question is that it will only remove what is put into the array, these
words are in lowercase, now how can I have the script parse the document
in lowercase?
If foul words start with a cap or their in uppercase the script won't
remove them.
I tried putting .toLowerCase(); into different parts of the script and
it powered me off a few times. Any help is appreciated. Thanks Joe

PS: this is a basic version of the script:
http://web2jo.com/TBed/LangFilter.html


What in the world does "it powered me off a few times" mean?

Your code is unreadable. You use too many single character
variable names and the formatting is useless. I do see that
you use eval() where it is not required, and I don't see any
indication that you're using regular expression matching,
which is the simple solution to your problem.

By the way, consider what your code does to this text:

"Why, hello madam. I assume you have a reservation."

Jul 23 '05 #3
On Sun, 30 Jan 2005 10:24:48 -0500, Papajo <do*****@webtv.net> wrote:
This script is designed to remove foul language from a document [...]


You should seriously consider what is "foul language". I would be hard
pressed to find anyone I know who thinks that the words filtered in your
example are offensive, irrespective of their usage (and by the way, dam
should be damn).

On a different note, HTML 3.2 is out-dated. Learn modern HTML and CSS, and
validate (<URL:http://validator.w3.org/>) your mark-up.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
rf
"Lee" <RE**************@cox.net> wrote
Papajo said:

Hi,
This script is designed to remove foul language from a document,
By the way, consider what your code does to this text:

"Why, hello madam. I assume you have a reservation."


Didn't do anything at all to "an Australian got kicked in the arse" :-)
Jul 23 '05 #5
JRS: In article <75**************@storefull-3332.bay.webtv.net>, dated
Sun, 30 Jan 2005 10:24:48, seen in news:comp.lang.javascript, Papajo
<do*****@webtv.net> posted :
This script is designed to remove foul language from a document,


Do you really wish to assert that you know all possible foul words? In
all languages? What is your opinion of fewmet, for example; or frazil?

Has it occurred to you that it is possible to generate foul expressions
from perfectly innocuous words? Or that some words are perfectly
acceptable in some contexts but not in others?

There's a word in the language defined by CSS which in combination with
a word used in a perfectly respectable manner in golf describes a type
of astronomical object. But I've heard that if those innocuous words
are translated literally into Russian the result is indescribably rude.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/> Update hope?
Jul 23 '05 #6

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

Similar topics

5
by: NK | last post by:
Hi all, Does anyone know of how I can disable case sensitivity for the LIKE function in SQL? Currently the SQL statement looks like: $query = "SELECT * FROM itrader_games WHERE...
10
by: Lakshmi Narayanan.R | last post by:
Hi Experts, Using keyword "To" in select case giving error.The following code is got from www.microsrosoft.com itself. What is the wrong with this?. <% Dim Number1 Number1 = 7 ' Initialize...
3
by: MHenry | last post by:
All the lower case "c" in my database table are now upper case "C" starting in January 2004. All prior data is fine. I just noticed this after installing a Microsoft update patch a couple of days...
5
by: Greg Collins [InfoPath MVP] | last post by:
I couldn't find anything in my searches... I'm wondering if there's a Regex (with or without additional C# code) that can convert a either "lowerCamelCase" or "UpperCamelCase" into a proper "Title...
7
by: Shapper | last post by:
Hello, I have a "Select Case MyVar" in which I define the values of an Array according to the value of MyVar. I need to use the Array Values in a Loop after End Select. It seems the Array is...
2
by: Dave Markle | last post by:
Good afternoon. I was just going through my code, analyzing it with FXCop, and FxCop gave me the following error on this code: MY CODE: Select Case termYears Case 5 : retVal.Append("1") Case...
9
by: Tonio Tanzi | last post by:
I have an asp page with this tag <body onLoad="show_msg('<%=error_msg%>');"> where "show_msg" is a javascript function that shows the message contained in the asp variable "error_msg" only if...
9
by: Robbie Hatley | last post by:
Greetings, group. I just found a weird problem in a program where a variable declared in a {block} after a "case" keyword was being treated as having value 0 even though its actual value should...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...

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.