PCRE2\_SET\_OPTIMIZE(3) Library Functions Manual PCRE2\_SET\_OPTIMIZE(3)

# [NAME](#NAME)

PCRE2 - Perl-compatible regular expressions (revised API)

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;pcre2.h&gt;**

```
int pcre2_set_optimize(pcre2_compile_context *ccontext,
  uint32_t directive);
```

# [DESCRIPTION](#DESCRIPTION)

This function controls which performance optimizations will be applied by **pcre2\_compile()**. It can be called multiple times with the same compile context; the effects are cumulative, with the effects of later calls taking precedence over earlier ones.

The result is zero for success, PCRE2\_ERROR\_NULL if *ccontext* is NULL, or PCRE2\_ERROR\_BADOPTION if *directive* is unknown. The latter could be useful to detect if a certain optimization is available.

The list of possible values for the *directive* parameter are:

PCRE2\_OPTIMIZATION\_FULL Enable all optimizations (default)  
PCRE2\_OPTIMIZATION\_NONE Disable all optimizations  
PCRE2\_AUTO\_POSSESS Enable auto-possessification  
PCRE2\_AUTO\_POSSESS\_OFF Disable auto-possessification  
PCRE2\_DOTSTAR\_ANCHOR Enable implicit dotstar anchoring  
PCRE2\_DOTSTAR\_ANCHOR\_OFF Disable implicit dotstar anchoring  
PCRE2\_START\_OPTIMIZE Enable start-up optimizations at match time  
PCRE2\_START\_OPTIMIZE\_OFF Disable start-up optimizations at match time

There is a complete description of the PCRE2 native API, including detailed descriptions *directive* parameter values in the **pcre2api** page.

22 September 2024 PCRE2 10.49

---

Document: pcre2_set_optimize(3) from pcre2 10.49-r2 (Chainguard OS)
Source: https://github.com/PCRE2Project/pcre2.git
