There are several different syntaxes in the wild for named capture, and although Python was the first to implement the feature, most libraries have adopted .NET's alternative syntax. The following comparison chart includes every regex library with named capture support that I am aware of. It is included to highlight the differences and similarities of named capture in XRegExp and libraries you might already be familiar with. XRegExp's syntax is listed first.
| Library | Capture | Backref in regex | Backref in replacement | Stored at | Backref numbering |
|---|---|---|---|---|---|
| XRegExp |
|
|
|
result.name
|
Sequential |
| .NET |
|
|
|
matcher.Groups('name') |
Unnamed first, then named |
| Perl 5.10 |
|
|
|
$+{name} |
Sequential |
| PCRE 7.2 |
|
|
N/A | Sequential | |
| PCRE 7 |
|
|
N/A | Sequential | |
| PCRE 4 |
|
|
N/A | Sequential | |
| Python |
|
|
|
result.group('name') |
Sequential |
| Oniguruma 1.8.4 |
|
|
|
N/A | Unnamed groups default to noncapturing when mixed with named groups |
| Java 7 |
|
|
|
matcher.group('name') |
Sequential |
| JGsoft |
|
|
|
N/A | .NET and Python styles, depending on capture syntax |
| Boost.Regex |
|
|
? | ? | ? |
| RE2 |
|
N/A | ? | ||
| JRegex |
|
|
|
matcher.group('name') |
? |