Running the above functions consecutively with the input and word lists shown in the first example: Of course the replacement words are chosen randomly so if I refreshed the page I’d get something else… But this shows what does/doesn’t get replaced.

Download a list of swear words (they're free as in beer and free as in speech): We've got a list of Frequently Asked Questions and some links to other resources on swearing, including other sites offering free or commercial lists of bad words (often better than the ones we offer). People will use passive aggression and sarcasm, People will use sentences/phrases not just words, It’s difficult to read/understand what it does. You can very easily use PHPs preg_replace_callback function: Okay, so what the preg_replace_callback does is it compiles a regex pattern consisting of all of the bad words. We've moved to static hosting to save costs, so the slightly silly server side highlighting had to go. But that's kind of the point. To follow the correct comment from Wrikken, I have totally forgotten about that strtr is case sensitive and that it’s better to follow word-boundary. While white space, start of string, and end of string are all considered word boundaries \b will not match in all cases, for example: This is because \b matches against non-word characters (i.e. I need an idea. Look up and browse swear & curse words on the swear word dictionary Below is a list of 0 user submitted swear words. From a system design perspective it’s generally bad form to have huge regexes for a couple of reasons: Given that the regex pattern is compiled by PHP the first reason is negated. One example of how we use these lists is to highlight swearwords to help human moderators spot swearing in user generated content, but you could do it just for comedy value. The swear words lists are provided "as-is" without any warranty or guarantee whatsoever. The function replace_words then takes the matched word and it’s boundaries (either blank or a white space character) and replaces it with the boundaries and a random good word.
I hope it will help you a bit but this is the best I can offer at the moment, as I’m totally not sure on what you’re trying to do.

You may use them for any purpose you wish and may copy, modify and distribute them freely. Already a Member? Shutterstock has a Github repo with a list of bad words used for filtering. Perhaps a client side example will follow one day? These lists are free to download.

Full List of Bad Words and Top Swear Words Banned by Google Free Downloads , Profanity , Profanity Filter , Profanity Word List / By James Parker Google blacklisted Words, Bad Words List, List of Swear Words Full List of Bad Words In English Profanity is a bad offensive social language that people use within their society, …

Promoting, selling, recruiting, coursework and thesis posting is forbidden. Same idea as in my second edit but not register dependent, it checks for word boundaries and puts a backslash in front of every character that is part of the regular expression syntax: February 26, 2018 Wordpress Leave a comment. Does anyone have a definitive swear word list for a online filter I'm using ? The second problem is that I don’t know how to deal with the users that type like this: “b a d”, “w o r d s”, etc.

I’m working on a WordPress plugin that replaces the bad words from the comments with random new ones from a list. Thank you for helping keep Tek-Tips Forums free from inappropriate posts.The Tek-Tips staff will check this out and take appropriate action. *Tek-Tips's functionality depends on members receiving e-mail. In this code I’ve used \b, \s, and ^ or $ as word boundaries there is a good reason for this.

If you were coming here looking for the dynamic highlighting example, it's gone for now.

Matches will then be in the format: The i modifier makes it case insensitive so both bad and Bad would match.

How to load local html files to make a host?

My first tought was to use str_ireplace, but it forgets if the original word had a capital letter. You can check it out here:

I now have 2 arrays: one containing the bad words and another containing the good words. Are we missing some words… Why? Here are a few.

Posted by: admin

Your email address will not be published. Already a member? css for mobile devices how to make '@media all' work on wordpress child theme, How to output wp_list_categories with extra markup. I am creating a proof reading system for online adverts and want to highlight words that look like they should be checked.

My first problem is that I want to turn off the case sensivity, so I won’t put the words like this "bad", "Bad", "BAD", "bAd", "BAd", etc but I need the new word to keep the format of the original word, for example if I write “Bad”, it would be replaced with “Words”, but if I type “bad”, it would be replaced with “words”, etc.

Since I’m a beginner, I got stuck at some point.

Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

The swear word lists themselves are free, take them, copy them, distribute them, love them. Bad words or bad language are common to most cultures but it varies from one place to another, for example, the American swear words list differs from Swiss swear words, bad words in Spanish differ from bad words in French Some footer stuff: The website, images and text are © 2007-2009. It's up to you. Stick to filtering common swear words and if that doesn’t work then – for the last time – implement a flagging/moderation system.

In order to replace the bad words, I’ve been using $newstring = str_replace($bad, $good, $string);. Returning true, in case there is an entry of bad words in the entry. jquery – Scroll child div edge to parent div edge, javascript – Problem in getting a return value from an ajax script, Combining two form values in a loop using jquery, jquery – Get id of element in Isotope filtered items, javascript – How can I get the background image URL in Jquery and then replace the non URL parts of the string, jquery – Angular 8 click is working as javascript onload function. Here’s my master list of filter words I try not to use when writing: See / saw Hear / heard Think / thought Touch / touched Wonder / wondered Seem / seemed Decide / decided Know / knew Feel / felt Look / looked Notice / noticed In order to make it select a random word, I think I can use $new = $good[rand(0, count($good)-1)]; then $newstring = str_replace($bad, $new, $string);.

Click Here to join Tek-Tips and talk with other members! javascript – window.addEventListener causes browser slowdowns – Firefox only. 1. javascript – How to get relative image coordinate of this div?

Swear Word Lists Download a list of swear words (they're free as in beer and free as in speech): swearWords.xml swearWords.txt swearWords.csv Other Stuff We've got a list of Frequently Asked Questions and some links to other resources on swearing, including other sites offering free or commercial lists of bad words (often better than the ones we offer). Copyright © 1998-2020, Inc. All rights reserved.Unauthorized reproduction or linking forbidden without expressed written permission. Well, since someone will be offended by any one thing at one time or another, maybe you could link to this: Dan, let me tell you something you already know... OK I have a 1276 bad words list I use for a forum (its a flat file, so you can extrapolate the data from it any way you want) - give an address and I'll send it on to you - OK? Don't blame me when the users of your forum, blog or community find more creative ways of offending people. Save my name, email, and website in this browser for the next time I comment.

Join your peers on the Internet's largest technical computer professional community.It's easy to join and it's free. The problem with this is that you have to match whole words, otherwise, for example, "Scunthorpe" would get filtered because it contains the substring "cxxx". Let’s combine an array with bad and good words into one, There’s a fire starting in my heart Reaching a fever pitch, and it’s bringing me out the dark Finally I can see you crystal clear Go ahead and sell me out and I’ll lay your ship bare.

November 8, 2017 By joining you are opting in to receive e-mail. There are (as has been pointed out in the comments numerous times) gaping wholes for you – and/or your code – to fall into through implementing such a feature, to name but a few: You’d do better to implement a moderation/flagging system where people can flag offensive comments which can then be edited/removed by mods, users, etc. RE: Swear words list for filter BillyRayPreachersSon (Programmer) 8 Aug 07 05:59 The problem with this is that you have to match whole words, otherwise, for example, "Scunthorpe" would get filtered because it contains the substring "cxxx".

If you have a better idea, I’m here to listen. By their very nature these lists of swear words contain material many will find offensive.

To clarify, I don’t see a problem have a small word list to filter out specific expletives as it serves a purpose: to stop users from having an outburst at one another; the problem comes when you try to filter out too much including permutations. How can I have the output with extra markup? - Delivering standards compliant, accessible web solutions. [^a-zA-Z0-9]) and characters like $ don’t count as word characters. I find wordpress too complicated for this purpose. Leave a comment. function noswear($string) { if ($string) { $bad = array("bad", "words"); $good = array("good", "words"); $newstring = str_replace($bad, $good, $string); return $newstring; } echo noswear("I see bad Thank you in advance for your help!

You could rewrite the above as a one liner using an anonymous function in the preg_replace_callback, If you’re going to use it multiple times you may also write it as a self-contained function, although in this case you’re most likely going to want to feed the good/bad words in to the function when calling it (or hard code them in there permanently) but that depends on how you derive them…. < M!ke >Your right to an opinion does not obligate me to take you seriously.- Winston Churchill, -kahtLisa, if you don't like your job you don't strike.

starting with the letter i.

I came up to this method and it’s working fine. You could write a swearword filter, but they don't work very well in the real world. As offered by rid it’s also possible to do simple in_array check: As I promised, I came up to the slightly different idea of replacing bad words with good words, as you mentioned in your question. I have borrowed the following example from PHP: strtr – Manual and modified it slightly. © 2014 - All Rights Reserved - Powered by. There are a bunch of other websites where people have done exactly the same thing as us.

That's the American way. Questions: I’m currently using the below script to output all my wordpress categories in an unordered list. You just go in every day and do it really half-assed. Registration on or use of this site constitutes acceptance of our Privacy Policy. Close this window and log in. Login.