RegExp Constructor
RegExp
Creates a new regular expression.Flags
RegExp supports all standard flags:| Flag | Name | Description |
|---|---|---|
g | global | Match all occurrences |
i | ignoreCase | Case-insensitive matching |
m | multiline | ^ and $ match line boundaries |
s | dotAll | . matches newlines |
u | unicode | Unicode mode |
y | sticky | Match from lastIndex only |
d | hasIndices | Generate match indices |
v | unicodeSets | Unicode set notation |
Instance Properties
source
The pattern text.flags
The flags string.global
Whether theg flag is set.
ignoreCase
Whether thei flag is set.
multiline
Whether them flag is set.
dotAll
Whether thes flag is set.
unicode
Whether theu flag is set.
sticky
Whether they flag is set.
lastIndex
The index at which to start the next match.Instance Methods
test
Tests if pattern matches a string.exec
Executes pattern and returns match details.Pattern Syntax
Porffor supports full RegExp syntax:Character Classes
Predefined Character Classes
Quantifiers
Anchors
Groups
Alternation
Lookahead
Backreferences
Usage Examples
Email Validation
Extract All Matches
String Replacement
Capture Groups
Named Capture Groups
Multiline Matching
String Integration
RegExp works seamlessly with String methods:Performance Notes
Porffor’s RegExp engine is compiled to WebAssembly for high performance:- Bytecode compilation: Patterns are compiled to efficient bytecode
- SIMD optimization: Uses SIMD for fast string comparison
- Zero-copy: Direct memory access without string copying
See Also
- String Built-ins - String methods using RegExp
- ByteString Utilities - String operations
- Global Functions - Pattern matching helpers