"Case Sensitive" Question

P

Papajo

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
 
L

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."
 
M

Mick White

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
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
 
M

Michael Winter

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
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Sun, 30 Jan 2005 10:24:48, seen in Papajo
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top