{"id":45734994,"url":"https://github.com/ieviev/resharp-dotnet","last_synced_at":"2026-02-28T13:02:01.594Z","repository":{"id":339969692,"uuid":"1163552345","full_name":"ieviev/resharp-dotnet","owner":"ieviev","description":"RE# -  A high-performance, automata based regex engine with first-class support for intersection and complement operations.","archived":false,"fork":false,"pushed_at":"2026-02-26T11:55:44.000Z","size":28288,"stargazers_count":39,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-26T14:24:58.587Z","etag":null,"topics":["regex","regex-engine"],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ieviev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-21T19:59:20.000Z","updated_at":"2026-02-26T14:16:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ieviev/resharp-dotnet","commit_stats":null,"previous_names":["ieviev/resharp-dotnet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ieviev/resharp-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieviev%2Fresharp-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieviev%2Fresharp-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieviev%2Fresharp-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieviev%2Fresharp-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ieviev","download_url":"https://codeload.github.com/ieviev/resharp-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieviev%2Fresharp-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29893606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T09:48:51.284Z","status":"ssl_error","status_checked_at":"2026-02-27T09:48:43.992Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["regex","regex-engine"],"created_at":"2026-02-25T10:58:37.543Z","updated_at":"2026-02-27T12:03:19.716Z","avatar_url":"https://github.com/ieviev.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RE#\n\n[![NuGet](https://img.shields.io/nuget/v/Resharp)](https://www.nuget.org/packages/Resharp)\n\nA high-performance, automata based regex engine with first-class support for **intersection** and **complement** operations.\n\nRE# compiles patterns into deterministic automata. All matching is non-backtracking with guaranteed linear-time execution. RE# extends `System.Text.RegularExpressions` syntax with intersection (`\u0026`), complement (`~`), and a universal wildcard (`_`), enabling patterns that are impossible or impractical to express with standard regex.\n\n[web playground](https://ieviev.github.io/resharp-webapp/) | [paper](https://dl.acm.org/doi/10.1145/3704837) | [blog post](https://iev.ee/blog/resharp-how-we-built-the-fastest-regex-in-fsharp/)\n\n## Install\n\n```\ndotnet add package Resharp\n```\n\n## Usage\n\n```csharp\n// contains \"cat\", \"dog\", AND is 8-15 characters long\nvar re = new Resharp.Regex(@\".*cat.*\u0026.*dog.*\u0026.{8,15}\");\n\n// instances are thread-safe, compile once and reuse\nre.Matches(\"the cat and the dog\");\n```\n\n## Syntax extensions\n\nRE# supports standard .NET regex syntax plus three extensions:\n\n### `_` -- universal wildcard\n\nMatches any character including newlines (`[\\s\\S]`).\n\n### `\u0026` -- intersection\n\nBoth sides must match. Intersection has higher precedence than alternation.\n\n```\n_*cat_*\u0026_*dog_*       contains both \"cat\" and \"dog\"\n_*cat_*\u0026_*dog_*\u0026_{5,30}  ...and is 5-30 characters long\n```\n\n### `~(...)` -- complement\n\nMatches everything the inner pattern does not match.\n\n```\n~(_*\\d\\d_*)     does not contain two consecutive digits\n~(_*\\n\\n_*)     does not contain a double newline\n```\n\u003cdetails\u003e\n\u003csummary\u003ewhy `_*` and not `.*`?\u003c/summary\u003e\n`.*` does not match newlines, so it does not mean \"any string\" (rather \"any one line\").\nwe specifically included `_` in the syntax so it's more intuitive to use with complement.\n\u003c/details\u003e\n\n### Combining operators\n\n```\nF.*\u0026~(_*Finn)                starts with 'F', does not end with \"Finn\"\n~(_*\\d\\d_*)\u0026[a-zA-Z\\d]{8,}  8+ alphanumeric, no consecutive digits\n```\n\n## Performance\n\nRE# uses several optimizations: start-set inference, literal prefix scanning, and optional full DFA precompilation. RE# shares many optimizations with .NET's (and `RegexOptions.NonBacktracking` even shares some RE# techniques and strengths that many do not know of!) but RE# is designed from the ground up and returns a different kind of matches (leftmost-longest).\n\nRE# particularly excels with large patterns and will often outperform .NET's regex engine (and all others) for complex patterns, especially those with a large set of alternatives, loops or using context-awareness - [RE# supports lookarounds](./docs/syntax.md#lookarounds), which is unique among automata engines.\n\nTo illustrate, here is a little comparison of RE# with .NET's most used compiled and source-generated regex engines on these patterns, you can also find wider comparisons [in the paper](https://dl.acm.org/doi/10.1145/3704837):\n\nOn [curated benchmarks from rebar](https://github.com/BurntSushi/rebar) (AMD Ryzen 7 5800X, .NET 10.0):\n\n| Pattern | RE# | .NET Compiled | .NET SourceGenerated | Speedup |\n|---------|----:|-----:|-----:|--------:|\n| date validation | 1,737 us | 273,822 us | 318,070 us | 158x |\n| dictionary search | 105 us | 45,832 us | 26,410 us | 252x |\n\nAnd on some extensions we added ourselves:\n\n| Pattern | RE# | .NET Compiled | .NET SourceGenerated | Speedup |\n|---------|----:|-----:|-----:|--------:|\n| dictionary, case-insensitive | 576 us | 29,368 us | 21,146 us | 37x |\n| unicode dictionary | 336 us | 62,053 us | 38,613 us | 115x |\n| unicode dictionary, case-insensitive | 321 us | 484,135 us | 537,814 us | 1,508x |\n| dictionary + context window | 621 us | 48,893 us | 55,383 us | 79x |\n| dictionary + context window, unicode | 692 us | 24,105,091 us | 34,706,982 us | 34,833x |\n\n\u003cdetails\u003e\n\u003csummary\u003eWhere is RegexOptions.NonBacktracking?\u003c/summary\u003e\n\nConveniently left out for shock effect `:^)`. `NonBacktracking` is actually much closer to RE#, but still behind. See the [paper](https://dl.acm.org/doi/10.1145/3704837) for a fairer comparison.\n\n\u003c/details\u003e\n\nFor critical paths, you can use `ValueMatches` for memory-pooled matching and `ResharpOptions.HighThroughputDefaults` for more aggressive optimization.\n\n```csharp\nvar re = new Resharp.Regex(\"pattern\", ResharpOptions.HighThroughputDefaults);\nusing var slices = re.ValueMatches(chars);\nforeach (var s in slices)\n    Console.WriteLine($\"match at {s.Index}..{s.Index + s.Length}\");\n```\n\n## Documentation\n\n- [Syntax reference](docs/syntax.md) -- full pattern syntax including `\u0026`, `~`, `_`\n- [API reference](docs/api.md) -- all public types and methods\n\n## Examples\n\nRunnable scripts in [`examples/`](examples/):\n\n| File | Description |\n|------|-------------|\n| [basic-syntax.fsx](examples/basic-syntax.fsx) | wildcards, intersection, complement |\n| [paragraph.fsx](examples/paragraph.fsx) | paragraph extraction with complement and intersection |\n| [validation.fsx](examples/validation.fsx) | date, IP, password validation with intersection |\n| [replace.fsx](examples/replace.fsx) | string and function-based replacement |\n| [lookaround.fsx](examples/lookaround.fsx) | lookahead, lookbehind, combined with intersection |\n| [high-throughput.fsx](examples/high-throughput.fsx) | zero-allocation matching for large inputs |\n| [Basic.cs](examples/Basic.cs) | C# usage |\n\n\n\nHave fun!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fieviev%2Fresharp-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fieviev%2Fresharp-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fieviev%2Fresharp-dotnet/lists"}