-
Notifications
You must be signed in to change notification settings - Fork 1
StdLib RegExp
Roger Johansson edited this page Jan 14, 2026
·
1 revision
The RegExp built-in provides regular expression support.
Implementation Status: 100% Complete
| Category | Items | Implemented |
|---|---|---|
| Constructor | 1 | 1 |
| Static Methods | 1 | 1 |
| Instance Methods | 4 | 4 |
| Symbol Methods | 5 | 5 |
| Property Getters | 10 | 10 |
| Legacy Static Props | 12 | 12 |
| Total | 33 | 33 |
new RegExp(pattern, flags)
new RegExp(regexp) // Clone with optional new flags
/pattern/flags // Literal syntax| Method | Status | Description |
|---|---|---|
RegExp[Symbol.species] |
Implemented | Returns constructor |
| Method | Status | Description |
|---|---|---|
test(string) |
Implemented | Tests for match, returns boolean |
exec(string) |
Implemented | Executes search, returns match array |
toString() |
Implemented | Returns /pattern/flags string |
compile(pattern, flags) |
Implemented | Legacy: recompiles regexp |
| Method | Status | Description |
|---|---|---|
[Symbol.match](string) |
Implemented | Called by String.match() |
[Symbol.matchAll](string) |
Implemented | Called by String.matchAll() |
[Symbol.replace](string, repl) |
Implemented | Called by String.replace() |
[Symbol.search](string) |
Implemented | Called by String.search() |
[Symbol.split](string, limit) |
Implemented | Called by String.split() |
| Property | Status | Description |
|---|---|---|
flags |
Implemented | All active flags (alphabetical) |
source |
Implemented | Pattern string |
global |
Implemented |
g flag |
ignoreCase |
Implemented |
i flag |
multiline |
Implemented |
m flag |
dotAll |
Implemented |
s flag |
unicode |
Implemented |
u flag |
unicodeSets |
Implemented |
v flag (ES2024) |
sticky |
Implemented |
y flag |
hasIndices |
Implemented |
d flag (ES2022) |
| Flag | Name | Description |
|---|---|---|
g |
global | Find all matches |
i |
ignoreCase | Case-insensitive |
m |
multiline | ^ and $ match line boundaries |
s |
dotAll |
. matches newlines |
u |
unicode | Unicode mode |
v |
unicodeSets | Unicode sets mode (ES2024) |
y |
sticky | Match at lastIndex only |
d |
hasIndices | Include indices in results |
exec() and match() return arrays with extra properties:
| Property | Description |
|---|---|
[0] |
Full match |
[1..n] |
Capture groups |
index |
Match position |
input |
Original string |
groups |
Named capture groups object |
indices |
Match indices (with d flag) |
| Property | Alias | Description |
|---|---|---|
RegExp.input |
$_ |
Last input string |
RegExp.lastMatch |
$& |
Last matched substring |
RegExp.lastParen |
$+ |
Last parenthesized match |
RegExp.leftContext |
$` |
Text before match |
RegExp.rightContext |
$' |
Text after match |
RegExp.$1 - $9
|
- | Capture group values |
JavaScript patterns are translated to .NET regex with:
- Unicode support for
\u{...}escapes - Surrogate pair handling
- Named group syntax conversion
- Full code point matching
- Surrogate pairs handled correctly
- Unicode property escapes (
\p{...})
- Set notation in character classes
- String literals in character classes
- Improved Unicode support
- Updated after
exec()withgoryflag - Reset to 0 when match fails
- Can be set manually
| File | Purpose |
|---|---|
StdLib/RegExp/RegExpConstructor.cs |
Constructor |
StdLib/RegExp/RegExpPrototype.cs |
Methods and properties |
StdLib/RegExp/RegExpHelper.cs |
Internal helpers |
JsTypes/JsRegExp.cs |
Core implementation |
- RegExp-Implementation - Deep dive into implementation
- StdLib-String - String pattern methods