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
16 pcre16 *pcre16_compile(PCRE_SPTR16 pattern, int options,
17 const char **errptr, int *erroffset,
18 const unsigned char *tableptr);
19
20 pcre32 *pcre32_compile(PCRE_SPTR32 pattern, int options,
21 const char **errptr, int *erroffset,
22 const unsigned char *tableptr);
23
25
26 This function compiles a regular expression into an internal form. It
27 is the same as pcre[16|32]_compile2(), except for the absence of the
28 errorcodeptr argument. Its arguments are:
29
30 pattern A zero-terminated string containing the
31 regular expression to be compiled
32 options Zero or more option bits
33 errptr Where to put an error message
34 erroffset Offset in pattern where error was found
35 tableptr Pointer to character tables, or NULL to
36 use the built-in default
37
38 The option bits are:
39
40 PCRE_ANCHORED Force pattern anchoring
41 PCRE_AUTO_CALLOUT Compile automatic callouts
42 PCRE_BSR_ANYCRLF \R matches only CR, LF, or CRLF
43 PCRE_BSR_UNICODE \R matches all Unicode line endings
44 PCRE_CASELESS Do caseless matching
45 PCRE_DOLLAR_ENDONLY $ not to match newline at end
46 PCRE_DOTALL . matches anything including NL
47 PCRE_DUPNAMES Allow duplicate names for subpatterns
48 PCRE_EXTENDED Ignore white space and # comments
49 PCRE_EXTRA PCRE extra features
50 (not much use currently)
51 PCRE_FIRSTLINE Force matching to be before newline
52 PCRE_JAVASCRIPT_COMPAT JavaScript compatibility
53 PCRE_MULTILINE ^ and $ match newlines within data
54 PCRE_NEVER_UTF Lock out UTF, e.g. via (*UTF)
55 PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
56 PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline
57 sequences
58 PCRE_NEWLINE_CR Set CR as the newline sequence
59 PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
60 PCRE_NEWLINE_LF Set LF as the newline sequence
61 PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren-
62 theses (named ones available)
63 PCRE_NO_AUTO_POSSESS Disable auto-possessification
64 PCRE_NO_START_OPTIMIZE Disable match-time start optimizations
65 PCRE_NO_UTF16_CHECK Do not check the pattern for UTF-16
66 validity (only relevant if
67 PCRE_UTF16 is set)
68 PCRE_NO_UTF32_CHECK Do not check the pattern for UTF-32
69 validity (only relevant if
70 PCRE_UTF32 is set)
71 PCRE_NO_UTF8_CHECK Do not check the pattern for UTF-8
72 validity (only relevant if
73 PCRE_UTF8 is set)
74 PCRE_UCP Use Unicode properties for \d, \w, etc.
75 PCRE_UNGREEDY Invert greediness of quantifiers
76 PCRE_UTF16 Run in pcre16_compile() UTF-16 mode
77 PCRE_UTF32 Run in pcre32_compile() UTF-32 mode
78 PCRE_UTF8 Run in pcre_compile() UTF-8 mode
79
80 PCRE must be built with UTF support in order to use PCRE_UTF8/16/32 and
81 PCRE_NO_UTF8/16/32_CHECK, and with UCP support if PCRE_UCP is used.
82
83 The yield of the function is a pointer to a private data structure that
84 contains the compiled pattern, or NULL if an error was detected. Note
85 that compiling regular expressions with one version of PCRE for use
86 with a different version is not guaranteed to work and may cause
87 crashes.
88
89 There is a complete description of the PCRE native API in the pcreapi
90 page and a description of the POSIX API in the pcreposix page.
91
92
93
94PCRE 8.34 01 October 2013 PCRE_COMPILE(3)