stephenhaunts / ProfanityDetector

This is a simple library for detecting profanities within a text string.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

willemaster opened this issue · 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

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