The regexp module provides functions for creating and working with regular expressions.
| Function | Description |
|---|
r.create[pattern; flags] | Create a RegExp from string pattern and optional flags |
r.escape[str] | Escape special regex characters in a string |
| Function | Description |
|---|
r.test[re; str] | Test if a string matches a pattern. Returns true/false |
r.match[re; str] | Match a string against a pattern. Returns match array or null |
r.matchall[re; str] | Return all matches (auto-adds g flag if needed) |
r.exec[re; str] | Execute a regex and return detailed match result |
| Function | Description |
|---|
r.replace[re; str; replacement] | Replace first match in string |
r.replaceall[re; str; replacement] | Replace all matches in string |
r.split[re; str] | Split a string by a regex pattern |
| Function | Description |
|---|
r.source[re] | Get the source pattern of a regex |
r.flags[re] | Get the flags of a regex |