MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 2 | #include <regexp.h> |
| 3 | |
Zesstra | b6ac9f6 | 2020-01-21 11:11:16 +0100 | [diff] [blame] | 4 | string * regexplode(string text, string pattern) |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 5 | string * regexplode(string text, string pattern, int opt) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 6 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 7 | DESCRIPTION |
| 8 | This function is similar to explode but accepts a regular |
| 9 | expression <pattern> as delimiter (interpreted according to <opt> |
| 10 | if given). |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 11 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 12 | If flag RE_OMIT_DELIM is not set in <opt>, then every second element |
| 13 | in the result vector will be the text that matched the delimiter. |
| 14 | If the flag is set, then the result vector will contain only |
| 15 | the text between the delimiters. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 16 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 17 | EXAMPLES |
| 18 | regexplode("abcdef", "cde") -> ({ "ab", "cde", "f" }) |
| 19 | regexplode("abcdef", "cde", RE_OMIT_DELIM) -> ({ "ab", "f" }) |
| 20 | |
| 21 | HISTORY |
| 22 | Introduced in 3.2@61. |
| 23 | LDMud 3.3 added the optional <opt> argument and the RE_OMIT_DELIM |
| 24 | flag. |
| 25 | Since 3.5.0 a error is raised if RE_PCRE is specified in <opt>, but |
| 26 | the driver lacks PCRE support. |
| 27 | |
| 28 | SEE ALSO |
| 29 | explode(E), regexp(E), regmatch(E), regreplace(E), |
| 30 | regexp_package(E), regexp(C) |