blob: ae5ccaa85248ef12ca52cb5f7daff73a3e2d6207 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 #include <regexp.h>
3
4 int regexp_package()
5
6DESCRIPTION
7 Return which regexp package is used by default:
8
9 RE_TRADITIONAL: traditional regexps
10 RE_PCRE: PCRE
11
12 As the package can be selected at runtime through the
13 REGEXP_PACKAGE driver hook, there is no good way to determine
14 the package at LPC compile time.
15 Match the pattern <pattern> (interpreted according to <opt> if
16 given) against all strings in list, and return a new array with all
17 strings that matched.
18
19 If there is an error in the regular expression, a runtime
20 error will be raised.
21
Zesstra715ec202025-07-09 22:18:31 +020022EXAMPLES
MG Mud User88f12472016-06-24 23:31:02 +020023 string strs;
24 string pattern;
25
26 if (regexp_package() == RE_PCRE)
27 pattern = "\\<help\\>.*\\<me\\>";
28 else
29 pattern = "\\bhelp\\b.*\\bme\\b";
30
Zesstra715ec202025-07-09 22:18:31 +020031 if (strs = regexp(({"please, help me Sir John."}), pattern)) {
32 if (sizeof(strs)
33 write("It matches.\n");
MG Mud User88f12472016-06-24 23:31:02 +020034 }
35
36 The regular expression will test the given string (which is
37 packed into an array) if there is something like "help ... me"
38 inside of it.
39
40HISTORY
41 Introduced in LDMud 3.3.634.
42
43SEE ALSO
44 regexp(E), regexplode(E), regmatch(E), regreplace(E), sscanf(E),
45 regexp(C), regexp_package(H)