Apache HTTPD
Classes | Macros | Enumerations | Functions | Variables
ap_regex.h File Reference

Apache Regex defines. More...

#include "apr.h"

Go to the source code of this file.

Classes

struct  ap_regex_t
 
struct  ap_regmatch_t
 
struct  ap_rxplus_t
 

Macros

#define AP_REG_ICASE   0x01 /** use a case-insensitive match */
 
#define AP_REG_NEWLINE   0x02 /** don't match newlines against '.' etc */
 
#define AP_REG_NOTBOL   0x04 /** ^ will not match against start-of-string */
 
#define AP_REG_NOTEOL   0x08 /** $ will not match against end-of-string */
 
#define AP_REG_EXTENDED   (0) /** unused */
 
#define AP_REG_NOSUB   (0) /** unused */
 
#define AP_REG_MULTI   0x10 /* perl's /g (needs fixing) */
 
#define AP_REG_NOMEM   0x20 /* nomem in our code */
 
#define AP_REG_DOTALL   0x40 /* perl's /s flag */
 
#define AP_REG_DOLLAR_ENDONLY   0x200 /* '$' matches at end of subject string only */
 
#define AP_REG_NO_DEFAULT   0x400
 
#define AP_REG_MATCH   "MATCH_"
 
#define AP_REG_DEFAULT   (AP_REG_DOTALL|AP_REG_DOLLAR_ENDONLY)
 
#define ap_rxplus_nmatch(rx)   (((rx)->match != NULL) ? (rx)->nmatch : 0)
 

Enumerations

enum  { AP_REG_PCRE_COMPILED = 0 , AP_REG_PCRE_LOADED }
 
enum  { AP_REG_ASSERT = 1 , AP_REG_ESPACE , AP_REG_INVARG , AP_REG_NOMATCH }
 

Functions

 AP_DECLARE (const char *) ap_pcre_version_string(int which)
 
 AP_DECLARE (int) ap_regcomp_get_default_cflags(void)
 
 AP_DECLARE (void) ap_regcomp_set_default_cflags(int cflags)
 
 AP_DECLARE (apr_size_t) ap_regerror(int errcode
 
 AP_DECLARE (ap_rxplus_t *) ap_rxplus_compile(apr_pool_t *pool
 
 AP_DECLARE (char *) ap_rxplus_pmatch(apr_pool_t *pool
 

Variables

const charregex
 
const char int cflags
 
const charstring
 
const char apr_size_t nmatch
 
const char apr_size_t ap_regmatch_tpmatch
 
const char apr_size_t ap_regmatch_t int eflags
 
const charbuff
 
const char apr_size_t len
 
const ap_regex_tpreg
 
const ap_regex_t charerrbuf
 
const ap_regex_t char apr_size_t errbuf_size
 
apr_array_header_tnames
 
apr_array_header_t const charprefix
 
apr_array_header_t const char int upper
 
const charpattern
 
ap_rxplus_trx
 
ap_rxplus_t const char char ** newpattern
 
int n
 
int int const char ** match
 

Detailed Description

Apache Regex defines.

Definition in file ap_regex.h.

Macro Definition Documentation

◆ AP_REG_DEFAULT

#define AP_REG_DEFAULT   (AP_REG_DOTALL|AP_REG_DOLLAR_ENDONLY)

Definition at line 91 of file ap_regex.h.

◆ AP_REG_DOLLAR_ENDONLY

#define AP_REG_DOLLAR_ENDONLY   0x200 /* '$' matches at end of subject string only */

Definition at line 85 of file ap_regex.h.

◆ AP_REG_DOTALL

#define AP_REG_DOTALL   0x40 /* perl's /s flag */

Definition at line 83 of file ap_regex.h.

◆ AP_REG_EXTENDED

#define AP_REG_EXTENDED   (0) /** unused */

Definition at line 78 of file ap_regex.h.

◆ AP_REG_ICASE

#define AP_REG_ICASE   0x01 /** use a case-insensitive match */

Definition at line 73 of file ap_regex.h.

◆ AP_REG_MATCH

#define AP_REG_MATCH   "MATCH_"

suggested prefix for ap_regname

Definition at line 89 of file ap_regex.h.

◆ AP_REG_MULTI

#define AP_REG_MULTI   0x10 /* perl's /g (needs fixing) */

Definition at line 81 of file ap_regex.h.

◆ AP_REG_NEWLINE

#define AP_REG_NEWLINE   0x02 /** don't match newlines against '.' etc */

Definition at line 74 of file ap_regex.h.

◆ AP_REG_NO_DEFAULT

#define AP_REG_NO_DEFAULT   0x400

Don't implicitely add AP_REG_DEFAULT options

Definition at line 87 of file ap_regex.h.

◆ AP_REG_NOMEM

#define AP_REG_NOMEM   0x20 /* nomem in our code */

Definition at line 82 of file ap_regex.h.

◆ AP_REG_NOSUB

#define AP_REG_NOSUB   (0) /** unused */

Definition at line 79 of file ap_regex.h.

◆ AP_REG_NOTBOL

#define AP_REG_NOTBOL   0x04 /** ^ will not match against start-of-string */

Definition at line 75 of file ap_regex.h.

◆ AP_REG_NOTEOL

#define AP_REG_NOTEOL   0x08 /** $ will not match against end-of-string */

Definition at line 76 of file ap_regex.h.

◆ ap_rxplus_nmatch

#define ap_rxplus_nmatch (   rx)    (((rx)->match != NULL) ? (rx)->nmatch : 0)

Definition at line 267 of file ap_regex.h.

Enumeration Type Documentation

◆ anonymous enum

Enumerator
AP_REG_PCRE_COMPILED 
AP_REG_PCRE_LOADED 

PCRE version used during program compilation PCRE version loaded at runtime

Definition at line 94 of file ap_regex.h.

◆ anonymous enum

Enumerator
AP_REG_ASSERT 
AP_REG_ESPACE 

internal error ?

AP_REG_INVARG 

failed to get memory

AP_REG_NOMATCH 

invalid argument match failed

Definition at line 100 of file ap_regex.h.

Function Documentation

◆ AP_DECLARE() [1/4]

AP_DECLARE ( ap_rxplus_t )

Compile a pattern into a regexp. supports perl-like formats match-string /match-string/flags s/match-string/replacement-string/flags Intended to support more perl-like stuff as and when round tuits happen match-string is anything supported by ap_regcomp replacement-string is a substitution string as supported in ap_pregsub flags should correspond with perl syntax: treat failure to do so as a bug (documentation TBD)

Parameters
poolPool to allocate from
patternPattern to compile
Returns
Compiled regexp, or NULL in case of compile/syntax error

◆ AP_DECLARE() [2/4]

AP_DECLARE ( apr_size_t  )

Return the error code returned by regcomp or regexec into error messages

Parameters
errcodethe error code returned by regexec or regcomp
pregThe precompiled regex
errbufA buffer to store the error in
errbuf_sizeThe size of the buffer

◆ AP_DECLARE() [3/4]

AP_DECLARE ( char )

Get a match from regex memory in a string copy NOTE: this relies on the match pattern from the last call to ap_rxplus_exec still being valid (i.e. not freed or out-of-scope)

Parameters
poolPool to allocate from
rxThe regexp
nThe match number to retrieve (must be between 0 and nmatch)
Returns
The matched string

◆ AP_DECLARE() [4/4]

AP_DECLARE ( const char )

Return PCRE version string.

Parameters
whichEither AP_REG_PCRE_COMPILED (PCRE version used during program compilation) or AP_REG_PCRE_LOADED (PCRE version used at runtime)
Returns
The PCRE version string

Variable Documentation

◆ buff

const char* buff

Definition at line 186 of file ap_regex.h.

◆ cflags

const char int cflags

Definition at line 159 of file ap_regex.h.

◆ eflags

Definition at line 172 of file ap_regex.h.

◆ errbuf

Definition at line 198 of file ap_regex.h.

◆ errbuf_size

Definition at line 198 of file ap_regex.h.

◆ len

const void apr_size_t len

Definition at line 187 of file ap_regex.h.

◆ match

static int match

Definition at line 279 of file ap_regex.h.

◆ n

Definition at line 278 of file ap_regex.h.

◆ names

Definition at line 209 of file ap_regex.h.

◆ newpattern

ap_rxplus_t const char char** newpattern

Definition at line 257 of file ap_regex.h.

◆ nmatch

Definition at line 172 of file ap_regex.h.

◆ pattern

ap_rxplus_t const char * pattern

Definition at line 243 of file ap_regex.h.

◆ pmatch

Definition at line 172 of file ap_regex.h.

◆ prefix

Definition at line 209 of file ap_regex.h.

◆ preg

Definition at line 197 of file ap_regex.h.

◆ regex

const char* regex

Definition at line 159 of file ap_regex.h.

◆ rx

Definition at line 256 of file ap_regex.h.

◆ string

const char* string

Definition at line 171 of file ap_regex.h.

◆ upper

Definition at line 210 of file ap_regex.h.