Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

🚀⚙️ IronRure - Rusty Regexs for .NET ⚙️🚀

Rure is the Rust Regular Expression crate. This repo provides a set of bindings so that it can be used from .NET.

Build Status

Getting Started

IronRure targets the .NET Standard runtime. It's available to install on NuGet:

> Install-Package IronRure

If you're targeting Linux, Windows or macOS then it's batteries included. If not then you'll need to supply your own compiled version of rure.


Walkthroughs and example code to get to know the basic features of IronRure.


IronRure is open source. Pull requests are welcome. See the Contributing Guidelines and Code of Conduct for more information.


The simplest operation is to check if a pattern matches anywhere in a given string:

using IronRure;

var re = new Regex(@"\d+");
Assert.True(re.IsMatch("I have 1 number"));
Assert.False(re.IsMatch("I don't"));

All Rust regular expression patterns are unanchored by default. This means that if you want to check if a pattern matches the entire string you'll need to add ^ and $ yourself:

var re = new Regex(@"^\w+$");

Assert.False(re.IsMatch("two words"));

To find the extent of the next match in a string Regex::Find can be used:

var re = new Regex(@"world");

var match = re.Find("hello world");
Assert.Equal(6U, match.Start);
Assert.Equal(11U, match.End);


To get information about the extent of each capture group in a regex the Regex::Captures method can be used. This method is slower than Regex::Find or Regex::IsMatch; only use it if you must retrieve capture information.

var dates = new Regex(@"(?P<day>\d{2})/(?P<month>\d{2})/(?P<year>\d{4})");

var haystack = "The first satellite was launched on 04/10/1957";
var caps = dates.Captures(haystack);
Assert.Equal("04", caps[dates["day"]].ExtractedString);
Assert.Equal("10", caps[dates["month"]].ExtractedString);
Assert.Equal("1957", caps[dates["year"]].ExtractedString);


In general IronRure out-performs .NET Regex, although milage may vary depending on the exact pattern and text. For more details checkout the benchmarks.

Syntax and Semantics

For more information about the pattern syntax see the underlying Rust crate documentation.

Windows Gotchas

The windows build of IronRure-Batteries requires the vc140 redistributable to work. This means you need to have Visual Studio 2015 or the Visual Studio 2015 C++ Runtime installed for it to load. If not you'll get an exception which claims that rure.dll can't be found.