php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_pcre.c File Reference
#include "php.h"
#include "php_ini.h"
#include "php_pcre.h"
#include "ext/standard/info.h"
#include "ext/standard/basic_functions.h"
#include "zend_smart_str.h"
#include "SAPI.h"
#include "php_pcre_arginfo.h"

Go to the source code of this file.

Data Structures

struct  _pcre_cache_entry
 

Macros

#define PREG_PATTERN_ORDER   1
 
#define PREG_SET_ORDER   2
 
#define PREG_OFFSET_CAPTURE   (1<<8)
 
#define PREG_UNMATCHED_AS_NULL   (1<<9)
 
#define PREG_SPLIT_NO_EMPTY   (1<<0)
 
#define PREG_SPLIT_DELIM_CAPTURE   (1<<1)
 
#define PREG_SPLIT_OFFSET_CAPTURE   (1<<2)
 
#define PREG_GREP_INVERT   (1<<0)
 
#define PREG_JIT   (1<<3)
 
#define PCRE_CACHE_SIZE   4096
 
#define PHP_PCRE_JIT_SUPPORT   0
 
#define php_pcre_mutex_alloc()
 
#define php_pcre_mutex_free()
 
#define php_pcre_mutex_lock()
 
#define php_pcre_mutex_unlock()
 
#define PHP_PCRE_DEFAULT_EXTRA_COPTIONS   PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
 
#define PHP_PCRE_PREALLOC_MDATA_SIZE   32
 

Functions

PHPAPI ZEND_DECLARE_MODULE_GLOBALS (pcre)
 
PHPAPI pcre_cache_entrypcre_get_compiled_regex_cache_ex (zend_string *regex, bool locale_aware)
 
PHPAPI pcre_cache_entrypcre_get_compiled_regex_cache (zend_string *regex)
 
PHPAPI pcre2_codepcre_get_compiled_regex (zend_string *regex, uint32_t *capture_count)
 
PHPAPI pcre2_match_dataphp_pcre_create_match_data (uint32_t capture_count, pcre2_code *re)
 
PHPAPI void php_pcre_free_match_data (pcre2_match_data *match_data)
 
PHPAPI void php_pcre_match_impl (pcre_cache_entry *pce, zend_string *subject_str, zval *return_value, zval *subpats, bool global, zend_long flags, zend_off_t start_offset)
 
 PHP_FUNCTION (preg_match)
 
 ZEND_FRAMELESS_FUNCTION (preg_match, 2)
 
 PHP_FUNCTION (preg_match_all)
 
PHPAPI zend_stringphp_pcre_replace (zend_string *regex, zend_string *subject_str, const char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count)
 
PHPAPI zend_stringphp_pcre_replace_impl (pcre_cache_entry *pce, zend_string *subject_str, const char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count)
 
 PHP_FUNCTION (preg_replace)
 
 ZEND_FRAMELESS_FUNCTION (preg_replace, 3)
 
 PHP_FUNCTION (preg_replace_callback)
 
 PHP_FUNCTION (preg_replace_callback_array)
 
 PHP_FUNCTION (preg_filter)
 
 PHP_FUNCTION (preg_split)
 
PHPAPI void php_pcre_split_impl (pcre_cache_entry *pce, zend_string *subject_str, zval *return_value, zend_long limit_val, zend_long flags)
 
 PHP_FUNCTION (preg_quote)
 
 PHP_FUNCTION (preg_grep)
 
PHPAPI void php_pcre_grep_impl (pcre_cache_entry *pce, zval *input, zval *return_value, zend_long flags)
 
 PHP_FUNCTION (preg_last_error)
 
 PHP_FUNCTION (preg_last_error_msg)
 
PHPAPI pcre2_match_contextphp_pcre_mctx (void)
 
PHPAPI pcre2_general_contextphp_pcre_gctx (void)
 
PHPAPI pcre2_compile_contextphp_pcre_cctx (void)
 
PHPAPI void php_pcre_pce_incref (pcre_cache_entry *pce)
 
PHPAPI void php_pcre_pce_decref (pcre_cache_entry *pce)
 
PHPAPI pcre2_codephp_pcre_pce_re (pcre_cache_entry *pce)
 

Variables

char * php_pcre_version
 
zend_module_entry pcre_module_entry
 

Macro Definition Documentation

◆ PCRE_CACHE_SIZE

#define PCRE_CACHE_SIZE   4096

Definition at line 38 of file php_pcre.c.

◆ PHP_PCRE_DEFAULT_EXTRA_COPTIONS

#define PHP_PCRE_DEFAULT_EXTRA_COPTIONS   PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK

Definition at line 204 of file php_pcre.c.

◆ PHP_PCRE_JIT_SUPPORT

#define PHP_PCRE_JIT_SUPPORT   0

Definition at line 43 of file php_pcre.c.

◆ php_pcre_mutex_alloc

#define php_pcre_mutex_alloc ( )

◆ php_pcre_mutex_free

#define php_pcre_mutex_free ( )

◆ php_pcre_mutex_lock

#define php_pcre_mutex_lock ( )

◆ php_pcre_mutex_unlock

#define php_pcre_mutex_unlock ( )

◆ PHP_PCRE_PREALLOC_MDATA_SIZE

#define PHP_PCRE_PREALLOC_MDATA_SIZE   32

Definition at line 209 of file php_pcre.c.

◆ PREG_GREP_INVERT

#define PREG_GREP_INVERT   (1<<0)

Definition at line 34 of file php_pcre.c.

◆ PREG_JIT

#define PREG_JIT   (1<<3)

Definition at line 36 of file php_pcre.c.

◆ PREG_OFFSET_CAPTURE

#define PREG_OFFSET_CAPTURE   (1<<8)

Definition at line 27 of file php_pcre.c.

◆ PREG_PATTERN_ORDER

#define PREG_PATTERN_ORDER   1

Definition at line 25 of file php_pcre.c.

◆ PREG_SET_ORDER

#define PREG_SET_ORDER   2

Definition at line 26 of file php_pcre.c.

◆ PREG_SPLIT_DELIM_CAPTURE

#define PREG_SPLIT_DELIM_CAPTURE   (1<<1)

Definition at line 31 of file php_pcre.c.

◆ PREG_SPLIT_NO_EMPTY

#define PREG_SPLIT_NO_EMPTY   (1<<0)

Definition at line 30 of file php_pcre.c.

◆ PREG_SPLIT_OFFSET_CAPTURE

#define PREG_SPLIT_OFFSET_CAPTURE   (1<<2)

Definition at line 32 of file php_pcre.c.

◆ PREG_UNMATCHED_AS_NULL

#define PREG_UNMATCHED_AS_NULL   (1<<9)

Definition at line 28 of file php_pcre.c.

Function Documentation

◆ pcre_get_compiled_regex()

PHPAPI pcre2_code * pcre_get_compiled_regex ( zend_string * regex,
uint32_t * capture_count )

Definition at line 892 of file php_pcre.c.

◆ pcre_get_compiled_regex_cache()

PHPAPI pcre_cache_entry * pcre_get_compiled_regex_cache ( zend_string * regex)

Definition at line 885 of file php_pcre.c.

◆ pcre_get_compiled_regex_cache_ex()

PHPAPI pcre_cache_entry * pcre_get_compiled_regex_cache_ex ( zend_string * regex,
bool locale_aware )

Definition at line 585 of file php_pcre.c.

◆ PHP_FUNCTION() [1/11]

PHP_FUNCTION ( preg_filter )

Definition at line 2528 of file php_pcre.c.

◆ PHP_FUNCTION() [2/11]

PHP_FUNCTION ( preg_grep )

Definition at line 2895 of file php_pcre.c.

◆ PHP_FUNCTION() [3/11]

PHP_FUNCTION ( preg_last_error )

Definition at line 3012 of file php_pcre.c.

◆ PHP_FUNCTION() [4/11]

PHP_FUNCTION ( preg_last_error_msg )

Definition at line 3021 of file php_pcre.c.

◆ PHP_FUNCTION() [5/11]

PHP_FUNCTION ( preg_match )

Definition at line 1475 of file php_pcre.c.

◆ PHP_FUNCTION() [6/11]

PHP_FUNCTION ( preg_match_all )

Definition at line 1506 of file php_pcre.c.

◆ PHP_FUNCTION() [7/11]

PHP_FUNCTION ( preg_quote )

Definition at line 2759 of file php_pcre.c.

◆ PHP_FUNCTION() [8/11]

PHP_FUNCTION ( preg_replace )

Definition at line 2374 of file php_pcre.c.

◆ PHP_FUNCTION() [9/11]

PHP_FUNCTION ( preg_replace_callback )

Definition at line 2404 of file php_pcre.c.

◆ PHP_FUNCTION() [10/11]

PHP_FUNCTION ( preg_replace_callback_array )

Definition at line 2437 of file php_pcre.c.

◆ PHP_FUNCTION() [11/11]

PHP_FUNCTION ( preg_split )

Definition at line 2535 of file php_pcre.c.

◆ php_pcre_cctx()

PHPAPI pcre2_compile_context * php_pcre_cctx ( void )

Definition at line 3064 of file php_pcre.c.

◆ php_pcre_create_match_data()

PHPAPI pcre2_match_data * php_pcre_create_match_data ( uint32_t capture_count,
pcre2_code * re )

Definition at line 906 of file php_pcre.c.

◆ php_pcre_free_match_data()

PHPAPI void php_pcre_free_match_data ( pcre2_match_data * match_data)

Definition at line 928 of file php_pcre.c.

◆ php_pcre_gctx()

PHPAPI pcre2_general_context * php_pcre_gctx ( void )

Definition at line 3059 of file php_pcre.c.

◆ php_pcre_grep_impl()

PHPAPI void php_pcre_grep_impl ( pcre_cache_entry * pce,
zval * input,
zval * return_value,
zend_long flags )

Definition at line 2921 of file php_pcre.c.

◆ php_pcre_match_impl()

PHPAPI void php_pcre_match_impl ( pcre_cache_entry * pce,
zend_string * subject_str,
zval * return_value,
zval * subpats,
bool global,
zend_long flags,
zend_off_t start_offset )

Definition at line 1156 of file php_pcre.c.

◆ php_pcre_mctx()

PHPAPI pcre2_match_context * php_pcre_mctx ( void )

Definition at line 3054 of file php_pcre.c.

◆ php_pcre_pce_decref()

PHPAPI void php_pcre_pce_decref ( pcre_cache_entry * pce)

Definition at line 3075 of file php_pcre.c.

◆ php_pcre_pce_incref()

PHPAPI void php_pcre_pce_incref ( pcre_cache_entry * pce)

Definition at line 3069 of file php_pcre.c.

◆ php_pcre_pce_re()

PHPAPI pcre2_code * php_pcre_pce_re ( pcre_cache_entry * pce)

Definition at line 3082 of file php_pcre.c.

◆ php_pcre_replace()

PHPAPI zend_string * php_pcre_replace ( zend_string * regex,
zend_string * subject_str,
const char * subject,
size_t subject_len,
zend_string * replace_str,
size_t limit,
size_t * replace_count )

Definition at line 1586 of file php_pcre.c.

◆ php_pcre_replace_impl()

PHPAPI zend_string * php_pcre_replace_impl ( pcre_cache_entry * pce,
zend_string * subject_str,
const char * subject,
size_t subject_len,
zend_string * replace_str,
size_t limit,
size_t * replace_count )

Definition at line 1614 of file php_pcre.c.

◆ php_pcre_split_impl()

PHPAPI void php_pcre_split_impl ( pcre_cache_entry * pce,
zend_string * subject_str,
zval * return_value,
zend_long limit_val,
zend_long flags )

Definition at line 2564 of file php_pcre.c.

◆ ZEND_DECLARE_MODULE_GLOBALS()

PHPAPI ZEND_DECLARE_MODULE_GLOBALS ( pcre )

Definition at line 65 of file php_pcre.c.

◆ ZEND_FRAMELESS_FUNCTION() [1/2]

ZEND_FRAMELESS_FUNCTION ( preg_match ,
2  )

Definition at line 1481 of file php_pcre.c.

◆ ZEND_FRAMELESS_FUNCTION() [2/2]

ZEND_FRAMELESS_FUNCTION ( preg_replace ,
3  )

Definition at line 2380 of file php_pcre.c.

Variable Documentation

◆ pcre_module_entry

zend_module_entry pcre_module_entry
Initial value:
= {
"pcre",
ext_functions,
PHP_MINIT(pcre),
PHP_RINIT(pcre),
PHP_MINFO(pcre),
PHP_GINIT(pcre),
}
#define NULL
Definition gdcache.h:45
#define PHP_GINIT
Definition php.h:397
#define PHP_MINFO
Definition php.h:396
#define PHP_RINIT
Definition php.h:394
#define PHP_MSHUTDOWN
Definition php.h:393
#define PHP_RSHUTDOWN
Definition php.h:395
#define PHP_MINIT
Definition php.h:392
#define PHP_MODULE_GLOBALS
Definition php.h:408
#define PHP_GSHUTDOWN
Definition php.h:398
#define PHP_PCRE_VERSION
Definition php_pcre.h:35
#define STANDARD_MODULE_HEADER
#define STANDARD_MODULE_PROPERTIES_EX

Definition at line 3031 of file php_pcre.c.

◆ php_pcre_version

char* php_pcre_version

Definition at line 46 of file php_pcre.c.