rex
Regular expressions.
Declared types
_match: (match: string, pos: int, length: int)
List of constants
| Name | Type | Description |
|---|---|---|
| case_insensitive | 1 | |
| cyrillic | 2 | |
| newline | 4 | |
| greed | 8 | |
| multiline | 16 | |
| extended | 32 |
Functions
1. rex::find
Finds all substrings matching given regular expression.
Type definition
func(regex: string, text: string -> list(tmatch))
List of arguments
| Name | Type | Description |
|---|---|---|
| regex | string | Regular expression to apply |
| text | string | Text to be matched with regular expression |
| modifiers | int | Reqular expression modifiers |
List of results
| Name | Type | Description |
|---|---|---|
| - | list(_match) | List of matches: string, position and length |
2. rex::match
Tests a string for matching given regular expression.
Type definition
func(regex: string, text: string -> bool)
List of arguments
| Name | Type | Description |
|---|---|---|
| regex | string | Regular expression to test |
| text | string | Text to be matched with regular expression |
| modifiers | int | Reqular expression modifiers |
List of results
| Name | Type | Description |
|---|---|---|
| - | bool | Match result |
3. rex::replace
Replaces all matched substring with given one.
Type definition
func(regex: string, text: string, replacement: string -> string)
List of arguments
| Name | Type | Description |
|---|---|---|
| regex | string | Regular expression to test |
| text | string | Source text |
| replacement | string | Replacement |
| modifiers | int | Reqular expression modifiers |
List of results
| Name | Type | Description |
|---|---|---|
| - | string | Text after replace |
4. rex::split
Splits string into list of strings by regular expression.
Type definition
func(regex: string, text: string -> list(string))
List of arguments
| Name | Type | Description |
|---|---|---|
| regex | string | Regular expression |
| text | string | Source text |
| modifiers | int | Reqular expression modifiers |
List of results
| Name | Type | Description |
|---|---|---|
| - | list(string) | Splitted text |