src/core/ngx_regex.h - nginx-1.7.10

Data types defined

Macros defined

Source code


  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */


  5. #ifndef _NGX_REGEX_H_INCLUDED_
  6. #define _NGX_REGEX_H_INCLUDED_


  7. #include <ngx_config.h>
  8. #include <ngx_core.h>

  9. #include <pcre.h>


  10. #define NGX_REGEX_NO_MATCHED  PCRE_ERROR_NOMATCH   /* -1 */

  11. #define NGX_REGEX_CASELESS    PCRE_CASELESS


  12. typedef struct {
  13.     pcre        *code;
  14.     pcre_extra  *extra;
  15. } ngx_regex_t;


  16. typedef struct {
  17.     ngx_str_t     pattern;
  18.     ngx_pool_t   *pool;
  19.     ngx_int_t     options;

  20.     ngx_regex_t  *regex;
  21.     int           captures;
  22.     int           named_captures;
  23.     int           name_size;
  24.     u_char       *names;
  25.     ngx_str_t     err;
  26. } ngx_regex_compile_t;


  27. typedef struct {
  28.     ngx_regex_t  *regex;
  29.     u_char       *name;
  30. } ngx_regex_elt_t;


  31. void ngx_regex_init(void);
  32. ngx_int_t ngx_regex_compile(ngx_regex_compile_t *rc);

  33. #define ngx_regex_exec(re, s, captures, size)                                \
  34.     pcre_exec(re->code, re->extra, (const char *) (s)->data, (s)->len, 0, 0, \
  35.               captures, size)
  36. #define ngx_regex_exec_n      "pcre_exec()"

  37. ngx_int_t ngx_regex_exec_array(ngx_array_t *a, ngx_str_t *s, ngx_log_t *log);


  38. #endif /* _NGX_REGEX_H_INCLUDED_ */