STRling.FSharp
3.0.0
dotnet add package STRling.FSharp --version 3.0.0
NuGet\Install-Package STRling.FSharp -Version 3.0.0
<PackageReference Include="STRling.FSharp" Version="3.0.0" />
<PackageVersion Include="STRling.FSharp" Version="3.0.0" />
<PackageReference Include="STRling.FSharp" />
paket add STRling.FSharp --version 3.0.0
#r "nuget: STRling.FSharp, 3.0.0"
#:package STRling.FSharp@3.0.0
#addin nuget:?package=STRling.FSharp&version=3.0.0
#tool nuget:?package=STRling.FSharp&version=3.0.0
STRling - F# Binding
Part of the STRling Project
<table> <tr> <td style="padding: 10px;"><img src="https://raw.githubusercontent.com/strling-lang/.github/refs/heads/main/strling_silver_bell.png" alt="STRling Logo" width="100" /></td> <td style="padding: 10px;"> <strong>The Universal Regular Expression Compiler.</strong><br><br> STRling is a next-generation production-grade syntax designed to make Regex readable, maintainable, and robust. It abstracts the cryptic nature of raw regex strings into a clean, object-oriented, and strictly typed interface that compiles to standard PCRE2 (or native) patterns. </td> </tr> </table>
💿 Installation
Install via NuGet:
dotnet add package STRling.FSharp
📦 Usage
Simply API (Recommended)
Here is how to match a US Phone number (e.g., 555-0199) using STRling's Simply API in F#:
open STRling.Simply
// Build a US phone number pattern: ^(\d{3})[-. ]?(\d{3})[-. ]?(\d{4})$
let phone =
merge [
start ()
capture (digit 3)
may (anyOf "-. ")
capture (digit 3)
may (anyOf "-. ")
capture (digit 4)
end' ()
]
// Compile to regex string
let regex = phone |> compile
printfn "%s" regex
// Output: ^(\d{3})[-. ]?(\d{3})[-. ]?(\d{4})$
DSL String Parsing
Alternatively, you can parse a DSL string directly using the Parser:
open STRling.Core
// Parse a DSL pattern string
let dsl = "start capture(digit(3)) may(anyOf('-. ')) capture(digit(3)) may(anyOf('-. ')) capture(digit(4)) end"
let ast = Parser.parse dsl
// Compile the AST to IR and emit
let ir = Compiler.compile ast
let regex = Emitters.PCRE2.emit ir
printfn "%s" regex
Note: This compiles to the optimized regex:
^(\d{3})[-. ]?(\d{3})[-. ]?(\d{4})$
🚀 Why STRling?
Regular Expressions are powerful but notorious for being "write-only" code. STRling solves this by treating Regex as Software, not a string.
- 🧩 Composability: Regex strings are hard to merge. STRling lets you build reusable components (e.g.,
ip_address,email) and safely compose them into larger patterns without breaking operator precedence or capturing groups. - 🛡️ Type Safety: Catch syntax errors, invalid ranges, and incompatible flags at compile time inside your IDE, not at runtime when your app crashes.
- 🧠 IntelliSense & Autocomplete: Stop memorizing cryptic codes like
(?<=...). Use fluent, self-documenting methods likesimply.lookBehind(...)with full IDE discovery. - 📖 Readability First: Code is read far more often than it is written. STRling patterns describe intent, making them understandable to junior developers and future maintainers instantly.
- 🌍 Polyglot Engine: One mental model, 17 languages. Whether you are writing Rust, Python, or TypeScript, the syntax and behavior remain identical.
🏗️ Architecture
STRling follows a strict compiler pipeline architecture to ensure consistency across all ecosystems:
- Parse:
DSL -> AST(Abstract Syntax Tree)- Converts the human-readable STRling syntax into a structured tree.
- Compile:
AST -> IR(Intermediate Representation)- Transforms the AST into a target-agnostic intermediate representation, optimizing structures like literal sequences.
- Emit:
IR -> Target Regex- Generates the final, optimized regex string for the specific target engine (e.g., PCRE2, JS, Python
re).
- Generates the final, optimized regex string for the specific target engine (e.g., PCRE2, JS, Python
📚 Documentation
- API Reference: Detailed documentation for this binding.
- Project Hub: The main STRling repository.
- Specification: The core grammar and semantic specifications.
🌐 Connect
💖 Support
If you find STRling useful, consider starring the repository and contributing!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net9.0
- FSharp.Core (>= 10.1.201)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 95 | 4/19/2026 |