![]() |
VOOZH | about |
dotnet add package nanoFramework.System.Text.RegularExpressions --version 1.1.128
NuGet\Install-Package nanoFramework.System.Text.RegularExpressions -Version 1.1.128
<PackageReference Include="nanoFramework.System.Text.RegularExpressions" Version="1.1.128" />
<PackageVersion Include="nanoFramework.System.Text.RegularExpressions" Version="1.1.128" />Directory.Packages.props
<PackageReference Include="nanoFramework.System.Text.RegularExpressions" />Project file
paket add nanoFramework.System.Text.RegularExpressions --version 1.1.128
#r "nuget: nanoFramework.System.Text.RegularExpressions, 1.1.128"
#:package nanoFramework.System.Text.RegularExpressions@1.1.128
#addin nuget:?package=nanoFramework.System.Text.RegularExpressions&version=1.1.128Install as a Cake Addin
#tool nuget:?package=nanoFramework.System.Text.RegularExpressions&version=1.1.128Install as a Cake Tool
👁 Quality Gate Status
👁 Reliability Rating
👁 NuGet
👁 #yourfirstpr
👁 Discord
| Component | Build Status | NuGet Package |
|---|---|---|
| System.Text.RegularExpressions | 👁 Build Status |
👁 NuGet |
Important: This Regular Expressions parser will cover most of your needs. It has some limitation when the pattern is complex and not a full compatibility. This is an on going work, mainly built on the .NET Microframework implementation. Please do not hesitate to raise any issue if any issue. Also, any help to improve this parser it's more than welcome.
In the you will find advance tests, so far only one is failing. Help to fix the parser needed!
The level of compatibility with the full framework is high. The Match, Group classes are working as you can expect. The following examples gives an idea of the usage:
// The example displays the following output:
// Match: This is one sentence.
// Group 1: 'This is one sentence.'
// Capture 1: 'This is one sentence.'
// Group 2: 'sentence'
// Capture 1: 'This '
// Capture 2: 'is '
// Capture 3: 'one '
// Capture 4: 'sentence'
// Group 3: 'sentence'
// Capture 1: 'This'
// Capture 2: 'is'
// Capture 3: 'one'
// Capture 4: 'sentence'
string pattern = @"(\b(\w+?)[,:;]?\s?)+[?.!]";
string input = "This is one sentence. This is a second sentence.";
Match match = Regex.Match(input, pattern);
Debug.WriteLine("Match: " + match.Value);
int groupCtr = 0;
foreach (Group group in match.Groups)
{
groupCtr++;
Debug.WriteLine(" Group " + groupCtr + ": '" + group.Value + "'");
int captureCtr = 0;
foreach (Capture capture in group.Captures)
{
captureCtr++;
Debug.WriteLine(" Capture " + captureCtr + ": '" + capture.Value + "'");
}
}
Another example using Split:
regex = new Regex("[ab]+");
acutalResults = regex.Split("xyzzyababbayyzabbbab123");
for (int i = 0; i < acutalResults.Length; i++)
{
Debug.WriteLine($"{acutalResults[i]}");
}
// The results will be:
// xyzzy
// yyz
// 123
You can as well use the Replace function:
regex = new Regex("a*b");
actual = regex.Replace("aaaabfooaaabgarplyaaabwackyb", "-");
Debug.WriteLine($"{actual}");
regex = new Regex("([a-b]+?)([c-d]+)");
actual = regex.Replace("zzabcdzz", "$1-$2");
Debug.WriteLine($"{actual}");
// The result will be:
// -foo-garply-wacky-
// zzab-cdzz
The next example shows the possibility to use options:
regex = new Regex("abc(\\w*)");
Debug.WriteLine("RegexOptions.IgnoreCase abc(\\w*)");
regex.Options = RegexOptions.IgnoreCase;
if (regex.IsMatch("abcddd"))
{
Debug.WriteLine("abcddd = true");
}
regex = new Regex("^abc$", RegexOptions.Multiline);
if (regex.IsMatch("\nabc"))
{
Debug.WriteLine("abc found!");
}
// The result will be:
// abcddd = true
// abc found!
You'll find in the tests some regular expressions used. Those can be useful:
([\w\d_.\-]+)@([\d\w\.\-]+)\.([\w\.]{2,5})(https?:\/\/)([\da-z-._]+)/?([\/\da-z.-]*) (limitation: URL has to finish with a / to be properly extracted, this is a bug into our engine, it works perfectly with the expression between ^ and $)[a-f0-9]{32}[A-Fa-f0-9]{64}<tag>[^<]*</tag>[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?2021-04-10 18:08:42: (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})This parser is a simple one, some of those elements are not supported:
(?<word>\w+) will not work. While groups are supported, the ? in front of a named group or element is not supported.\. you may encounter issues, just use . instead.[a-z-._]For documentation, providing feedback, issues and finding out how to contribute please refer to the Home repo.
Join our Discord community here.
The list of contributors to this project can be found at CONTRIBUTORS.
The nanoFramework Class Libraries are licensed under the .
Please check the header of the files in this repository, some of the code is under Apache License 2.0.
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community. For more information see the .NET Foundation Code of Conduct.
This project is supported by the .NET Foundation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net net is compatible. |
Showing the top 2 NuGet packages that depend on nanoFramework.System.Text.RegularExpressions:
| Package | Downloads |
|---|---|
|
DevBot9.NanoFramework.Homie
Homie implementation for nanoFramework. |
|
|
DevBot9.NanoFramework.Homie.Utilities
Homie implementation for nanoFramework. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0-preview.30 | 55 | 5/29/2026 |
| 2.0.0-preview.28 | 67 | 5/27/2026 |
| 2.0.0-preview.23 | 56 | 5/11/2026 |
| 2.0.0-preview.19 | 54 | 4/30/2026 |
| 2.0.0-preview.18 | 60 | 4/29/2026 |
| 2.0.0-preview.15 | 54 | 4/20/2026 |
| 2.0.0-preview.14 | 65 | 4/17/2026 |
| 2.0.0-preview.9 | 86 | 1/15/2026 |
| 2.0.0-preview.7 | 78 | 1/12/2026 |
| 1.1.128 | 467 | 4/2/2025 |
| 1.1.123 | 422 | 3/10/2025 |
| 1.1.115 | 339 | 2/25/2025 |
| 1.1.108 | 332 | 2/4/2025 |
| 1.1.106 | 325 | 2/4/2025 |
| 1.1.102 | 295 | 1/30/2025 |
| 1.1.95 | 326 | 1/6/2025 |
| 1.1.80 | 365 | 9/27/2024 |
| 1.1.51 | 643 | 11/9/2023 |
| 1.1.37 | 984 | 12/28/2022 |
| 1.1.26 | 677 | 10/26/2022 |