blob: ca67db826fce17adde5ed4297bafd30d7d66b30c [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra715ec202025-07-09 22:18:31 +02002 #include <regexp.h>
3
Zesstrab6ac9f62020-01-21 11:11:16 +01004 string * regexplode(string text, string pattern)
Zesstra715ec202025-07-09 22:18:31 +02005 string * regexplode(string text, string pattern, int opt)
MG Mud User88f12472016-06-24 23:31:02 +02006
Zesstra715ec202025-07-09 22:18:31 +02007DESCRIPTION
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 User88f12472016-06-24 23:31:02 +020011
Zesstra715ec202025-07-09 22:18:31 +020012 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 User88f12472016-06-24 23:31:02 +020016
Zesstra715ec202025-07-09 22:18:31 +020017EXAMPLES
18 regexplode("abcdef", "cde") -> ({ "ab", "cde", "f" })
19 regexplode("abcdef", "cde", RE_OMIT_DELIM) -> ({ "ab", "f" })
20
21HISTORY
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
28SEE ALSO
29 explode(E), regexp(E), regmatch(E), regreplace(E),
30 regexp_package(E), regexp(C)