blob: 354e6a6865a40dc85f2043df7226cbac190d2a89 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 #include <regexp.h>
3
4 string *regexp(string *list, string pattern)
5 string *regexp(string *list, string pattern, int opt)
6
7DESCRIPTION
8 Match the pattern <pattern> (interpreted according to <opt> if
9 given) against all strings in list, and return a new array with all
10 strings that matched.
11
12 If there is an error in the regular expression, a runtime
13 error will be raised.
14
15EXAMPLE
16 string strs;
17 string pattern;
18
19 if (regexp_package() == RE_PCRE)
20 pattern = "\\<help\\>.*\\<me\\>";
21 else
22 pattern = "\\bhelp\\b.*\\bme\\b";
23
24 if (strs = regexp( ({"please, help me Sir John."}),
25 , pattern
26 ))
27 {
28 if (sizeof(strs)
29 write("It matches.\n");
30 }
31
32 The regular expression will test the given string (which is
33 packed into an array) if there is something like "help ... me"
34 inside of it.
35
36HISTORY
37 LDMud 3.3 added the optional <opt> argument.
38
39SEE ALSO
40 regexplode(E), regmatch(E), regreplace(E), regexp_package(E), sscanf(E),
41 regexp(C)