ktsu.TextFilter
1.5.3
Prefix Reserved
dotnet add package ktsu.TextFilter --version 1.5.3
NuGet\Install-Package ktsu.TextFilter -Version 1.5.3
<PackageReference Include="ktsu.TextFilter" Version="1.5.3" />
<PackageVersion Include="ktsu.TextFilter" Version="1.5.3" />
<PackageReference Include="ktsu.TextFilter" />
paket add ktsu.TextFilter --version 1.5.3
#r "nuget: ktsu.TextFilter, 1.5.3"
#addin nuget:?package=ktsu.TextFilter&version=1.5.3
#tool nuget:?package=ktsu.TextFilter&version=1.5.3
ktsu.TextFilter
A .NET library for filtering text using glob patterns, regular expressions, and fuzzy matching
Introduction
ktsu.TextFilter is a .NET library that provides methods for filtering text based on different filter types and match options. It supports glob patterns, regular expressions, and fuzzy matching to help you efficiently filter and search through collections of strings.
Features
- Glob Pattern Matching: Filter text using glob patterns with optional, required, and excluded tokens.
- Regular Expression Matching: Filter text using regular expressions.
- Fuzzy Matching: Rank text based on how well it matches a fuzzy pattern.
- Customizable Match Options: Match by whole string, all words, or any word.
Installation
Package Manager Console
Install-Package ktsu.TextFilter
.NET CLI
dotnet add package ktsu.TextFilter
Package Reference
<PackageReference Include="ktsu.TextFilter" Version="x.y.z" />
Usage Examples
Basic Example
using ktsu.TextFilter;
string text = "Hello, World!";
string pattern = "Hello*";
bool isMatch = TextFilter.Match(text, pattern);
Filtering Collections
using ktsu.TextFilter;
string[] texts = new string[] { "Hello, World!", "Goodbye, World!" };
string pattern = "Hello*";
IEnumerable<string> matches = TextFilter.Filter(texts, pattern);
Ranking Results
using ktsu.TextFilter;
string[] texts = new string[] { "Hello, World!", "Goodbye, World!" };
string pattern = "Hello";
IEnumerable<string> ranked = TextFilter.Rank(texts, pattern);
Advanced Usage
Match Options
You can customize how matching is performed using the MatchOptions
enum:
using ktsu.TextFilter;
string text = "Hello beautiful world";
string pattern = "hello world";
// Match by any word in the pattern
bool anyWordMatch = TextFilter.Match(text, pattern, MatchOptions.AnyWord);
// Match by all words in the pattern
bool allWordsMatch = TextFilter.Match(text, pattern, MatchOptions.AllWords);
// Match the entire string
bool wholeStringMatch = TextFilter.Match(text, pattern, MatchOptions.WholeString);
Filter Types
TextFilter supports different filter types:
using ktsu.TextFilter;
string text = "Hello, World!";
string globPattern = "Hello*";
string regexPattern = "^Hello";
// Glob pattern matching
bool globMatch = TextFilter.Match(text, globPattern, filterType: FilterType.Glob);
// Regular expression matching
bool regexMatch = TextFilter.Match(text, regexPattern, filterType: FilterType.Regex);
// Fuzzy matching
bool fuzzyMatch = TextFilter.Match(text, "Helo", filterType: FilterType.Fuzzy);
API Reference
TextFilter
Class
The primary class for text filtering operations.
Methods
Name | Return Type | Description |
---|---|---|
Match(string text, string pattern, MatchOptions options = MatchOptions.WholeString, FilterType filterType = FilterType.Glob) |
bool |
Tests if the input text matches the specified pattern |
Filter(IEnumerable<string> texts, string pattern, MatchOptions options = MatchOptions.WholeString, FilterType filterType = FilterType.Glob) |
IEnumerable<string> |
Returns all texts that match the pattern |
Rank(IEnumerable<string> texts, string pattern, MatchOptions options = MatchOptions.WholeString) |
IEnumerable<string> |
Returns texts ranked by how well they match the pattern |
Enums
MatchOptions
Value | Description |
---|---|
WholeString |
Match the entire string against the pattern |
AllWords |
Match all words in the pattern against the string |
AnyWord |
Match any word in the pattern against the string |
FilterType
Value | Description |
---|---|
Glob |
Use glob pattern matching |
Regex |
Use regular expression matching |
Fuzzy |
Use fuzzy matching |
Contributing
Contributions are welcome! For feature requests, bug reports, or questions, please open an issue on GitHub. If you would like to contribute code, please open a pull request with your changes.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- DotNet.Glob for glob pattern matching.
- ktsu.FuzzySearch for fuzzy matching.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- DotNet.Glob (>= 3.1.3)
- ktsu.Extensions (>= 1.5.5)
- ktsu.FuzzySearch (>= 1.2.1)
-
net9.0
- DotNet.Glob (>= 3.1.3)
- ktsu.Extensions (>= 1.5.5)
- ktsu.FuzzySearch (>= 1.2.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on ktsu.TextFilter:
Package | Downloads |
---|---|
ktsu.ImGuiWidgets
A library of custom widgets using ImGui.NET and utilities to enhance ImGui-based applications. |
|
ktsu.ImGuiPopups
A library for custom popups using ImGui.NET. |
|
ktsu.PkmnDB
PkmnDB |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.5.3 | 272 | 5/21/2025 |
1.5.3-pre.17 | 114 | 5/20/2025 |
1.5.3-pre.15 | 76 | 5/17/2025 |
1.5.3-pre.14 | 121 | 5/16/2025 |
1.5.3-pre.13 | 189 | 5/15/2025 |
1.5.3-pre.12 | 195 | 5/14/2025 |
1.5.3-pre.11 | 197 | 5/13/2025 |
1.5.3-pre.10 | 225 | 5/12/2025 |
1.5.3-pre.9 | 159 | 5/11/2025 |
1.5.3-pre.8 | 102 | 5/10/2025 |
1.5.3-pre.7 | 48 | 5/9/2025 |
1.5.3-pre.6 | 117 | 5/8/2025 |
1.5.3-pre.5 | 116 | 5/7/2025 |
1.5.3-pre.4 | 115 | 5/6/2025 |
1.5.3-pre.3 | 116 | 5/5/2025 |
1.5.3-pre.2 | 124 | 5/4/2025 |
1.5.3-pre.1 | 115 | 5/4/2025 |
1.5.2 | 243 | 5/4/2025 |
1.5.2-pre.2 | 50 | 4/26/2025 |
1.5.2-pre.1 | 112 | 4/4/2025 |
1.5.1 | 656 | 3/30/2025 |
1.5.0 | 410 | 3/30/2025 |
1.4.1 | 97 | 3/29/2025 |
1.4.1-pre.3 | 75 | 3/29/2025 |
1.4.1-pre.2 | 450 | 3/25/2025 |
1.4.1-pre.1 | 66 | 2/18/2025 |
1.4.0 | 897 | 2/17/2025 |
1.3.2-pre.26 | 68 | 2/12/2025 |
1.3.2-pre.25 | 71 | 2/6/2025 |
1.3.2-pre.24 | 63 | 2/5/2025 |
1.3.2-pre.23 | 60 | 2/5/2025 |
1.3.2-pre.22 | 65 | 2/3/2025 |
1.3.2-pre.21 | 65 | 2/3/2025 |
1.3.2-pre.20 | 68 | 2/1/2025 |
1.3.2-pre.19 | 59 | 1/30/2025 |
1.3.2-pre.18 | 66 | 1/28/2025 |
1.3.2-pre.17 | 57 | 1/26/2025 |
1.3.2-pre.16 | 58 | 1/24/2025 |
1.3.2-pre.15 | 62 | 1/22/2025 |
1.3.2-pre.14 | 54 | 1/20/2025 |
1.3.2-pre.13 | 55 | 1/19/2025 |
1.3.2-pre.12 | 59 | 1/17/2025 |
1.3.2-pre.11 | 51 | 1/15/2025 |
1.3.2-pre.10 | 39 | 1/14/2025 |
1.3.2-pre.9 | 62 | 1/13/2025 |
1.3.2-pre.8 | 62 | 1/11/2025 |
1.3.2-pre.7 | 53 | 1/10/2025 |
1.3.2-pre.6 | 55 | 1/10/2025 |
1.3.2-pre.5 | 49 | 1/8/2025 |
1.3.2-pre.4 | 62 | 1/7/2025 |
1.3.2-pre.3 | 76 | 1/5/2025 |
1.3.2-pre.2 | 83 | 1/3/2025 |
1.3.2-pre.1 | 67 | 1/3/2025 |
1.3.1 | 724 | 1/3/2025 |
1.3.0 | 98 | 1/3/2025 |
1.2.0 | 104 | 1/3/2025 |
1.1.5 | 159 | 12/27/2024 |
1.1.5-pre.7 | 71 | 1/3/2025 |
1.1.5-pre.6 | 68 | 1/2/2025 |
1.1.5-pre.5 | 84 | 12/31/2024 |
1.1.5-pre.4 | 60 | 12/30/2024 |
1.1.5-pre.3 | 62 | 12/29/2024 |
1.1.5-pre.2 | 57 | 12/28/2024 |
1.1.5-pre.1 | 58 | 12/27/2024 |
1.1.4-pre.1 | 57 | 12/27/2024 |
1.1.3-pre.1 | 58 | 12/27/2024 |
1.1.2-pre.1 | 62 | 12/27/2024 |
1.1.1 | 110 | 12/26/2024 |
1.1.0 | 107 | 12/26/2024 |
1.0.19 | 755 | 12/26/2024 |
1.0.18 | 96 | 12/26/2024 |
1.0.17 | 98 | 12/26/2024 |
1.0.16 | 109 | 12/26/2024 |
1.0.15 | 96 | 12/26/2024 |
1.0.14 | 97 | 12/26/2024 |
1.0.13 | 103 | 12/26/2024 |
1.0.12 | 101 | 12/25/2024 |
1.0.11 | 243 | 12/23/2024 |
1.0.10 | 122 | 12/23/2024 |
1.0.9 | 101 | 12/23/2024 |
1.0.8 | 102 | 12/22/2024 |
1.0.7 | 95 | 12/22/2024 |
1.0.6 | 90 | 12/22/2024 |
1.0.5 | 94 | 12/22/2024 |
1.0.4 | 103 | 12/22/2024 |
1.0.3 | 102 | 12/22/2024 |
1.0.2 | 148 | 12/22/2024 |
1.0.1 | 189 | 12/19/2024 |
1.0.0 | 116 | 12/19/2024 |
## v1.5.3
Initial release or repository with no prior history.