Apache Regex defines.
More...
Go to the source code of this file.
|
const char * | ap_pcre_version_string (int which) |
|
int | ap_regcomp_get_default_cflags (void) |
|
void | ap_regcomp_set_default_cflags (int cflags) |
|
int | ap_regcomp_default_cflag_by_name (const char *name) |
|
int | ap_regcomp (ap_regex_t *preg, const char *regex, int cflags) |
|
int | ap_regexec (const ap_regex_t *preg, const char *string, apr_size_t nmatch, ap_regmatch_t *pmatch, int eflags) |
|
int | ap_regexec_len (const ap_regex_t *preg, const char *buff, apr_size_t len, apr_size_t nmatch, ap_regmatch_t *pmatch, int eflags) |
|
apr_size_t | ap_regerror (int errcode, const ap_regex_t *preg, char *errbuf, apr_size_t errbuf_size) |
|
int | ap_regname (const ap_regex_t *preg, apr_array_header_t *names, const char *prefix, int upper) |
|
void | ap_regfree (ap_regex_t *preg) |
|
ap_rxplus_t * | ap_rxplus_compile (apr_pool_t *pool, const char *pattern) |
|
int | ap_rxplus_exec (apr_pool_t *pool, ap_rxplus_t *rx, const char *pattern, char **newpattern) |
|
int | ap_rxplus_nmatch (ap_rxplus_t *rx) |
|
void | ap_rxplus_match (ap_rxplus_t *rx, int n, int *len, const char **match) |
|
char * | ap_rxplus_pmatch (apr_pool_t *pool, ap_rxplus_t *rx, int n) |
|
◆ AP_REG_ANCHORED
#define AP_REG_ANCHORED 0x100 |
Match at the first position
◆ AP_REG_DEFAULT
◆ AP_REG_DOLLAR_ENDONLY
#define AP_REG_DOLLAR_ENDONLY 0x200 |
'$' matches at end of subject string only
◆ AP_REG_DOTALL
#define AP_REG_DOTALL 0x40 |
◆ AP_REG_EXTENDED
#define AP_REG_EXTENDED (0) |
◆ AP_REG_ICASE
#define AP_REG_ICASE 0x01 |
use a case-insensitive match
◆ AP_REG_MATCH
#define AP_REG_MATCH "MATCH_" |
suggested prefix for ap_regname
◆ AP_REG_MULTI
#define AP_REG_MULTI 0x10 |
◆ AP_REG_NEWLINE
#define AP_REG_NEWLINE 0x02 |
don't match newlines against '.' etc
◆ AP_REG_NO_DEFAULT
#define AP_REG_NO_DEFAULT 0x400 |
Don't implicitely add AP_REG_DEFAULT options
◆ AP_REG_NOMEM
#define AP_REG_NOMEM 0x20 |
◆ AP_REG_NOSUB
◆ AP_REG_NOTBOL
#define AP_REG_NOTBOL 0x04 |
^ will not match against start-of-string
◆ AP_REG_NOTEMPTY
#define AP_REG_NOTEMPTY 0x080 |
◆ AP_REG_NOTEOL
#define AP_REG_NOTEOL 0x08 |
$ will not match against end-of-string
◆ anonymous enum
Enumerator |
---|
AP_REG_PCRE_COMPILED | |
AP_REG_PCRE_LOADED | PCRE version used during program compilation PCRE version loaded at runtime
|
◆ 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
|
◆ ap_pcre_version_string()
const char* ap_pcre_version_string |
( |
int |
which | ) |
|
Return PCRE version string.
- Parameters
-
which | Either 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
◆ ap_regcomp()
Compile a regular expression.
- Parameters
-
preg | Returned compiled regex |
regex | The regular expression string |
cflags | Bitwise OR of AP_REG_* flags (ICASE and NEWLINE supported, other flags are ignored) |
- Returns
- Zero on success or non-zero on error
◆ ap_regcomp_default_cflag_by_name()
int ap_regcomp_default_cflag_by_name |
( |
const char * |
name | ) |
|
Get the AP_REG_* corresponding to the string.
- Parameters
-
name | The name (i.e. AP_REG_<name>) |
- Returns
- The AP_REG_*, or zero if the string is unknown
◆ ap_regcomp_get_default_cflags()
int ap_regcomp_get_default_cflags |
( |
void |
| ) |
|
Get default compile flags
- Returns
- Bitwise OR of AP_REG_* flags
◆ ap_regcomp_set_default_cflags()
void ap_regcomp_set_default_cflags |
( |
int |
cflags | ) |
|
Set default compile flags
- Parameters
-
cflags | Bitwise OR of AP_REG_* flags |
◆ ap_regerror()
Return the error code returned by regcomp or regexec into error messages
- Parameters
-
errcode | the error code returned by regexec or regcomp |
preg | The precompiled regex |
errbuf | A buffer to store the error in |
errbuf_size | The size of the buffer |
◆ ap_regexec()
Match a NUL-terminated string against a pre-compiled regex.
- Parameters
-
preg | The pre-compiled regex |
string | The string to match |
nmatch | Provide information regarding the location of any matches |
pmatch | Provide information regarding the location of any matches |
eflags | Bitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported, other flags are ignored) |
- Returns
- 0 for successful match,
AP_REG_NOMATCH
otherwise
◆ ap_regexec_len()
Match a string with given length against a pre-compiled regex. The string does not need to be NUL-terminated.
- Parameters
-
preg | The pre-compiled regex |
buff | The string to match |
len | Length of the string to match |
nmatch | Provide information regarding the location of any matches |
pmatch | Provide information regarding the location of any matches |
eflags | Bitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported, other flags are ignored) |
- Returns
- 0 for successful match, AP_REG_NOMATCH otherwise
◆ ap_regfree()
Destroy a pre-compiled regex.
- Parameters
-
preg | The pre-compiled regex to free. |
◆ ap_regname()
Return an array of named regex backreferences
- Parameters
-
preg | The precompiled regex |
names | The array to which the names will be added |
prefix | An optional prefix to add to the returned names. AP_REG_MATCH is the recommended prefix. |
upper | If non zero, uppercase the names |
◆ ap_rxplus_compile()
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
-
pool | Pool to allocate from |
pattern | Pattern to compile |
- Returns
- Compiled regexp, or NULL in case of compile/syntax error
◆ ap_rxplus_exec()
Apply a regexp operation to a string.
- Parameters
-
pool | Pool to allocate from |
rx | The regex match to apply |
pattern | The string to apply it to NOTE: This MUST be kept in scope to use regexp memory |
newpattern | The modified string (ignored if the operation doesn't modify the string) |
- Returns
- Number of times a match happens. Normally 0 (no match) or 1 (match found), but may be greater if a transforming pattern is applied with the 'g' flag.
◆ ap_rxplus_match()
Get a pointer to a match from regex memory 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
-
rx | The regexp |
n | The match number to retrieve (must be between 0 and nmatch) |
len | Returns the length of the match. |
match | Returns the match pattern |
◆ ap_rxplus_nmatch()
Number of matches in the regexp operation's memory This may be 0 if no match is in memory, or up to nmatch from compilation
- Parameters
-
- Returns
- Number of matches in memory
◆ ap_rxplus_pmatch()
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
-
pool | Pool to allocate from |
rx | The regexp |
n | The match number to retrieve (must be between 0 and nmatch) |
- Returns
- The matched string