Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Replace word function


Message #1 by keithblyth@h... on Wed, 19 Feb 2003 05:01:15
var strText =3D strText.replace(/****|*******/g, "*****");


/Robert


-----Original Message-----
From: keithblyth@h... [mailto:keithblyth@h...]
Sent: den 19 februari 2003 06:01
To: JavaScript HowTo
Subject: [javascript_howto] Replace word function


Hi does anybody have a function for removing swear words from a text
field.  This is for use with a database driven event colander.  Each
message will be placed in a variable in this format "&event".
$count . "Event=3D"
<b><i>urlencode ($event)</i></b>
The reason for any odd syntax is the database is queried in php but I
will
end up with a variable called event.n.event=3D"Text to be checked"- 
where
n
is a number.
So I want to check each event up to the last one (using the count var)
for
forbidden words and replace them with a random !@#$%^&* character - or
just ******. What ever
Thanks for the help in advance

  Return to Index