
Show HN: No-swears – remove swear words from JavaScript strings - gmemstr
https://github.com/gmemstr/no-swears
======
eesmith
Looks like it doesn't handle the Scunthorpe Problem -
[http://tvtropes.org/pmwiki/pmwiki.php/Main/ScunthorpeProblem](http://tvtropes.org/pmwiki/pmwiki.php/Main/ScunthorpeProblem)
.

~~~
gmemstr
Totally open for suggestion on how to fix this - right now I'm using regex and
a list of "profane" words, so nothing too fancy. But I'm interested in looking
into solutions for this problem.

~~~
eesmith
There is no easy solution. Look at that TVTropes page for a long list of
failure cases.

This approach is at least 20 years old. Others have worked on it. Try
investigating one or more of
[https://github.com/topics/profanity](https://github.com/topics/profanity) .

------
nukeop
Could be interesting to include an optional argument callback that would
receive the part of the string that's being censored and returns a string to
replace that part of the word with - so that you can conditionally prevent
censorship or censor it with something else than __*.

~~~
ateesdalejr
You mean change it to a less offensive word? That would actually be
interesting.

------
jarnix
So if I write BbitchIbitchTbitchCbitchHbitch, it would give me B ____* I __
__* T __ __* C __ __* H ?

