https://github.com/r3c/mure
MUlti-valued Regular Expressions
https://github.com/r3c/mure
csharp regular-expression regular-expressions
Last synced: 5 months ago
JSON representation
MUlti-valued Regular Expressions
- Host: GitHub
- URL: https://github.com/r3c/mure
- Owner: r3c
- License: mit
- Created: 2019-03-23T21:25:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2026-01-21T13:59:13.000Z (5 months ago)
- Last Synced: 2026-01-22T01:49:06.117Z (5 months ago)
- Topics: csharp, regular-expression, regular-expressions
- Language: C#
- Size: 184 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# Mure: MUlti-valued Regular Expressions
[](https://github.com/r3c/mure/actions/workflows/verify.yml)
[](https://opensource.org/licenses/MIT)
## Overview
Mure is a text stream matching engine with support for a subset of regular
expressions, able to bind several patterns to a corresponding value and return
the one value associated to matched pattern. This allows forward-only text
parsing while mapping each matched sequence to corresponding value, which is a
efficient solution for tokenization tasks e.g. when writing lexers.
## Usage
There is no user documentation available yet, sorry!
Here is a simple code sample:
```csharp
var matcher = Compiler
.CreateFromRegex()
.AddPattern("[0-9]+", LexemType.Number)
.AddPattern("\\+", LexemType.Plus)
.AddPattern("-", LexemType.Minus)
.Compile();
using (var reader = new StringReader("27+32-4"))
{
var iterator = matcher.Open(reader);
while (iterator.TryMatchNext(out var match))
Console.WriteLine($"Matched {match.Value}: {match.Capture}");
}
```
Running this code will print to standard output:
```
Matched Number: 27
Matched Plus: +
Matched Number: 32
Matched Minus: -
Matched Number: 4
```
## Resource
- Contact: v.github.com+mure [at] mirari [dot] fr
- License: [license.md](license.md)