#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Dover, NH
    Posts
    14
    Rep Power
    0
    How would I search for odd charecters such as: , , , , , , , , , etc.

    On my website I try to filter out "bad" words and asterick "*" them out, but the users are getting smarter using such charecters as the above.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    1
    Rep Power
    0
    $message =~ s/[^W]/*/ig;

    That would change all non-alphanumeric (a-z, A-Z, 0-9, underscores and spaces) to an asterix.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Dover, NH
    Posts
    14
    Rep Power
    0
    That would work, but I only want to asteric out certain words, ie: ****, bitch, *** hole, etc. I want to be able to leave things like: Th n g since it doen't contain swear words.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    Heh, well to bad. You can't have a regular expression filter out bad words and odd characters at the same time (unless you can think of every possible combination of swear words with those characters.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Dover, NH
    Posts
    14
    Rep Power
    0
    Lets just say I wanted to filter out one particular word like: pssy (the one I am tring to filter out), how can I write a query to recognise this?
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    0
    Rep Power
    0
    This is what I do to remove unwanted words in variable:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    $FORM{'text'} =~ s/pssy//g;
    $FORM{'text'} =~ s/www//g;
    $FORM{'text'} =~ s/internet//g;
    [/code]
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Dover, NH
    Posts
    14
    Rep Power
    0
    The problem is that
    $FORM{'text'} =~ s/pssy/p****/g;
    does not work. This is the way that I do search for "bad" swear words, but the "" seems to mees things up.

IMN logo majestic logo threadwatch logo seochat tools logo