diff --git a/.gitignore b/.gitignore index 468efa9..5a21054 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ ProfanityFilter/ProfanityFilter/bin/Release/netstandard2.1/ ProfanityFilter/.idea/.idea.ProfanityFilter/.idea/ ProfanityFilter/.idea/.idea.ProfanityFilter/ + +ProfanityFilter/ProfanityFilter/bin/Release/netstandard2.0/ + +ProfanityFilter/ProfanityFilter/Properties/PublishProfiles/ diff --git a/ProfanityFilter.Tests.Unit/ProfanityTests.cs b/ProfanityFilter.Tests.Unit/ProfanityTests.cs index 8587667..33c48f2 100644 --- a/ProfanityFilter.Tests.Unit/ProfanityTests.cs +++ b/ProfanityFilter.Tests.Unit/ProfanityTests.cs @@ -880,5 +880,23 @@ public void ContainsProfanityReturnsFalseWhenProfanityDoesNotExist() Assert.IsFalse(result); } + + [TestMethod] + public void ContainsProfanityReturnsFalseWhenProfanityIsAaa() + { + var filter = new ProfanityFilter(); + var result = filter.ContainsProfanity("aaa"); + + Assert.IsFalse(result); + } + + [TestMethod] + public void ContainsProfanityReturnsTrueWhenProfanityIsADollarDollar() + { + var filter = new ProfanityFilter(); + var result = filter.ContainsProfanity("a$$"); + + Assert.IsTrue(result); + } } } \ No newline at end of file diff --git a/ProfanityFilter/ProfanityFilter/ProfanityFilter.cs b/ProfanityFilter/ProfanityFilter/ProfanityFilter.cs index 097710d..22319d1 100644 --- a/ProfanityFilter/ProfanityFilter/ProfanityFilter.cs +++ b/ProfanityFilter/ProfanityFilter/ProfanityFilter.cs @@ -272,7 +272,7 @@ public bool ContainsProfanity(string term) return false; } - Regex regex = new Regex(string.Format(@"(?:{0})", string.Join("|", potentialProfanities), RegexOptions.IgnoreCase)); + Regex regex = new Regex(string.Format(@"(?:{0})", string.Join("|", potentialProfanities).Replace("$", "\\$"), RegexOptions.IgnoreCase)); foreach (Match profanity in regex.Matches(term)) { diff --git a/ProfanityFilter/ProfanityFilter/ProfanityFilter.csproj b/ProfanityFilter/ProfanityFilter/ProfanityFilter.csproj index 3bbe649..4fd50d2 100644 --- a/ProfanityFilter/ProfanityFilter/ProfanityFilter.csproj +++ b/ProfanityFilter/ProfanityFilter/ProfanityFilter.csproj @@ -4,7 +4,7 @@ netstandard2.0 true Profanity.Detector - 0.1.5 + 0.1.7 Stephen Haunts en https://github.com/stephenhaunts/ProfanityDetector/blob/master/LICENSE diff --git a/ProfanityFilter/ProfanityFilter/Properties/PublishProfiles/FolderProfile.pubxml b/ProfanityFilter/ProfanityFilter/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index fd36ee8..0000000 --- a/ProfanityFilter/ProfanityFilter/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - FileSystem - Release - AnyCPU - bin/Release/netstandard2.1/publish - false - netstandard2.1 - false - <_IsPortable>true - - \ No newline at end of file diff --git a/ProfanityFilter/nupkgs/Profanity.Detector.0.1.6.nupkg b/ProfanityFilter/nupkgs/Profanity.Detector.0.1.6.nupkg new file mode 100644 index 0000000..026ed84 Binary files /dev/null and b/ProfanityFilter/nupkgs/Profanity.Detector.0.1.6.nupkg differ diff --git a/ProfanityFilter/nupkgs/Profanity.Detector.0.1.7.nupkg b/ProfanityFilter/nupkgs/Profanity.Detector.0.1.7.nupkg new file mode 100644 index 0000000..d7e9412 Binary files /dev/null and b/ProfanityFilter/nupkgs/Profanity.Detector.0.1.7.nupkg differ diff --git a/README.md b/README.md index 3c0a71c..2035d44 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,10 @@ In this readme I will cover the following: # Release notes +0.1.7 : Contains a community contributed bug fix to a regular expression. + +0.1.6 : Contains a community contribution to add a new method, ContainsProfanity, that will check for a profanity without the Scunthorpe checking. + 0.1.5 : Update API to remove references to a white list and instead rename it to an allow list. If you install this newget package you will need to update the method class references for the white list. No functionality has changed. 0.1.4 : Fixed issues #5 and #6 @@ -27,13 +31,13 @@ In this readme I will cover the following: If you do not wish to download or clone this repository, then you can consume the profanity detector via [Nuget](https://www.nuget.org/packages/Profanity.Detector/). -To install via the package manager use the command (assuming version 0.1.5 of the library) +To install via the package manager use the command (assuming version 0.1.7 of the library) -Install-Package Profanity.Detector -Version 0.1.5 +Install-Package Profanity.Detector -Version 0.1.7 Or via the command line -dotnet add package Profanity.Detector --version 0.1.5 +dotnet add package Profanity.Detector --version 0.1.7 # Example Usage