News for hackers. Stuff that matters.
Re:Show HN: No-swears – remove swear words from JavaScript s... by eesmith on Tuesday January 02, 2018 @04:10PM (#16055669)
Looks like it doesn't handle the Scunthorpe Problem - http://tvtropes.org/pmwiki/pmwiki.php/Main/ScunthorpeProblem .
Re:Show HN: No-swears – remove swear words from JavaScript s... by gmemstr on Tuesday January 02, 2018 @04:13PM (#16055699)
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.
Re:Show HN: No-swears – remove swear words from JavaScript s... by eesmith on Tuesday January 02, 2018 @04:28PM (#16055868)
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 .

Re:Show HN: No-swears – remove swear words from JavaScript s... by nukeop on Wednesday January 03, 2018 @04:15AM (#16059598)
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 *.
Re:Show HN: No-swears – remove swear words from JavaScript s... by ateesdalejr on Thursday January 04, 2018 @03:44PM (#16073908)
You mean change it to a less offensive word? That would actually be interesting.
Re:Show HN: No-swears – remove swear words from JavaScript s... by jarnix on Thursday January 04, 2018 @09:50AM (#16070641)
So if I write BbitchIbitchTbitchCbitchHbitch, it would give me B * I * T * C * H ?