C# regexes share some syntax with PCRE regexes. Most of the features overlap but both libraries keep their own specifics:
A couple examples:
PCRE
- Supports recursion
- Supports backtrack control verbs
- Supports constructs like
(?(DEFINE) ... )
- Supports more options
- Offers a DFA parsing mode
- Supports partial matches
- Supports
K
- Supports
X++
shorthand syntax (equivalent of (?>X+)
)
.NET
- Supports capture stacks and duplicate named groups
- Supports balancing groups
- Supports variable length lookbehind
This list is not exhaustive. You can compare both flavours on this page and the sibling pages.
Given the differences, I wanted to be able to use PCRE regexes from .NET and recently started PCRE.NET, which is a wrapper project. It's not finished yet but is starting to be usable.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…