blob: 8b8d29f8e4f1bdc73827889bfa3c315856834b1c [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
22EXAMPLE
23 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
31 if (strs = regexp( ({"please, help me Sir John."}),
32 , pattern
33 ))
34 {
35 if (sizeof(strs)
36 write("It matches.\n");
37 }
38
39 The regular expression will test the given string (which is
40 packed into an array) if there is something like "help ... me"
41 inside of it.
42
43HISTORY
44 Introduced in LDMud 3.3.634.
45
46SEE ALSO
47 regexp(E), regexplode(E), regmatch(E), regreplace(E), sscanf(E),
48 regexp(C), regexp_package(H)