ProfanityDetector icon indicating copy to clipboard operation
ProfanityDetector copied to clipboard

Profanity list entries containing '$' causing regex to fail for ContainsProfanity()

Open willemaster opened this issue 6 years ago • 1 comments

Hi,

It looks like the entry 'a$$' on the profanity list is triggering any word ending in 'a' as a profanity, because the '$'s are not escaped, as demonstrated by this failing test:

        [TestMethod]
        public void ContainsProfanityReturnsFalseWhenProfanityIsAaa()
        {
            var filter = new ProfanityFilter();
            var result = filter.ContainsProfanity("aaa");

            Assert.IsFalse(result);
        }

I have a fix and will submit a PR shortly.

thanks

willemaster avatar Jul 15 '20 11:07 willemaster

Thanks for the pull request. I have merged it back into main and will get the NuGet package republished.

stephenhaunts avatar Jul 18 '20 08:07 stephenhaunts