1PCRE_COMPILE(3) Library Functions Manual PCRE_COMPILE(3)
2
3
4
6 PCRE - Perl-compatible regular expressions
7
9
10 #include <pcre.h>
11
12 pcre *pcre_compile(const char *pattern, int options,
13 const char **errptr, int *erroffset,
14 const unsigned char *tableptr);
15
17
18 This function compiles a regular expression into an internal form. It
19 is the same as pcre_compile2(), except for the absence of the errorā
20 codeptr argument. Its arguments are:
21
22 pattern A zero-terminated string containing the
23 regular expression to be compiled
24 options Zero or more option bits
25 errptr Where to put an error message
26 erroffset Offset in pattern where error was found
27 tableptr Pointer to character tables, or NULL to
28 use the built-in default
29
30 The option bits are:
31
32 PCRE_ANCHORED Force pattern anchoring
33 PCRE_AUTO_CALLOUT Compile automatic callouts
34 PCRE_BSR_ANYCRLF \R matches only CR, LF, or CRLF
35 PCRE_BSR_UNICODE \R matches all Unicode line endings
36 PCRE_CASELESS Do caseless matching
37 PCRE_DOLLAR_ENDONLY $ not to match newline at end
38 PCRE_DOTALL . matches anything including NL
39 PCRE_DUPNAMES Allow duplicate names for subpatterns
40 PCRE_EXTENDED Ignore whitespace and # comments
41 PCRE_EXTRA PCRE extra features
42 (not much use currently)
43 PCRE_FIRSTLINE Force matching to be before newline
44 PCRE_JAVASCRIPT_COMPAT JavaScript compatibility
45 PCRE_MULTILINE ^ and $ match newlines within data
46 PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
47 PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline
48 sequences
49 PCRE_NEWLINE_CR Set CR as the newline sequence
50 PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
51 PCRE_NEWLINE_LF Set LF as the newline sequence
52 PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren-
53 theses (named ones available)
54 PCRE_NO_UTF8_CHECK Do not check the pattern for UTF-8
55 validity (only relevant if
56 PCRE_UTF8 is set)
57 PCRE_UCP Use Unicode properties for \d, \w, etc.
58 PCRE_UNGREEDY Invert greediness of quantifiers
59 PCRE_UTF8 Run in UTF-8 mode
60
61 PCRE must be built with UTF-8 support in order to use PCRE_UTF8 and
62 PCRE_NO_UTF8_CHECK, and with UCP support if PCRE_UCP is used.
63
64 The yield of the function is a pointer to a private data structure that
65 contains the compiled pattern, or NULL if an error was detected. Note
66 that compiling regular expressions with one version of PCRE for use
67 with a different version is not guaranteed to work and may cause
68 crashes.
69
70 There is a complete description of the PCRE native API in the pcreapi
71 page and a description of the POSIX API in the pcreposix page.
72
73
74
75 PCRE_COMPILE(3)