PostgreSQL Source Code  git master
regex.h File Reference
#include "mb/pg_wchar.h"
Include dependency graph for regex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  regex_t
 
struct  regmatch_t
 
struct  rm_detail_t
 

Macros

#define _REGEX_H_   /* never again */
 
#define REG_UBACKREF   000001 /* has back-reference (\n) */
 
#define REG_ULOOKAROUND   000002 /* has lookahead/lookbehind constraint */
 
#define REG_UBOUNDS   000004 /* has bounded quantifier ({m,n}) */
 
#define REG_UBRACES   000010 /* has { that doesn't begin a quantifier */
 
#define REG_UBSALNUM   000020 /* has backslash-alphanumeric in non-ARE */
 
#define REG_UPBOTCH
 
#define REG_UBBS   000100 /* has backslash within bracket expr */
 
#define REG_UNONPOSIX   000200 /* has any construct that extends POSIX */
 
#define REG_UUNSPEC
 
#define REG_UUNPORT   001000 /* has numeric character code dependency */
 
#define REG_ULOCALE   002000 /* has locale dependency */
 
#define REG_UEMPTYMATCH   004000 /* can match a zero-length string */
 
#define REG_UIMPOSSIBLE   010000 /* provably cannot match anything */
 
#define REG_USHORTEST   020000 /* has non-greedy quantifier */
 
#define REG_BASIC   000000 /* BREs (convenience) */
 
#define REG_EXTENDED   000001 /* EREs */
 
#define REG_ADVF   000002 /* advanced features in EREs */
 
#define REG_ADVANCED   000003 /* AREs (which are also EREs) */
 
#define REG_QUOTE   000004 /* no special characters, none */
 
#define REG_NOSPEC   REG_QUOTE /* historical synonym */
 
#define REG_ICASE   000010 /* ignore case */
 
#define REG_NOSUB   000020 /* caller doesn't need subexpr match data */
 
#define REG_EXPANDED   000040 /* expanded format, white space & comments */
 
#define REG_NLSTOP   000100 /* \n doesn't match . or [^ ] */
 
#define REG_NLANCH   000200 /* ^ matches after \n, $ before */
 
#define REG_NEWLINE   000300 /* newlines are line terminators */
 
#define REG_PEND   000400 /* ugh -- backward-compatibility hack */
 
#define REG_EXPECT   001000 /* report details on partial/limited matches */
 
#define REG_BOSONLY   002000 /* temporary kludge for BOS-only matches */
 
#define REG_DUMP   004000 /* none of your business :-) */
 
#define REG_FAKE   010000 /* none of your business :-) */
 
#define REG_PROGRESS   020000 /* none of your business :-) */
 
#define REG_NOTBOL   0001 /* BOS is not BOL */
 
#define REG_NOTEOL   0002 /* EOS is not EOL */
 
#define REG_STARTEND   0004 /* backward compatibility kludge */
 
#define REG_FTRACE   0010 /* none of your business */
 
#define REG_MTRACE   0020 /* none of your business */
 
#define REG_SMALL   0040 /* none of your business */
 
#define REG_OKAY   0 /* no errors detected */
 
#define REG_NOMATCH   1 /* failed to match */
 
#define REG_BADPAT   2 /* invalid regexp */
 
#define REG_ECOLLATE   3 /* invalid collating element */
 
#define REG_ECTYPE   4 /* invalid character class */
 
#define REG_EESCAPE   5 /* invalid escape \ sequence */
 
#define REG_ESUBREG   6 /* invalid backreference number */
 
#define REG_EBRACK   7 /* brackets [] not balanced */
 
#define REG_EPAREN   8 /* parentheses () not balanced */
 
#define REG_EBRACE   9 /* braces {} not balanced */
 
#define REG_BADBR   10 /* invalid repetition count(s) */
 
#define REG_ERANGE   11 /* invalid character range */
 
#define REG_ESPACE   12 /* out of memory */
 
#define REG_BADRPT   13 /* quantifier operand invalid */
 
#define REG_ASSERT   15 /* "can't happen" -- you found a bug */
 
#define REG_INVARG   16 /* invalid argument to regex function */
 
#define REG_MIXED   17 /* character widths of regex and string differ */
 
#define REG_BADOPT   18 /* invalid embedded option */
 
#define REG_ETOOBIG   19 /* regular expression is too complex */
 
#define REG_ECOLORS   20 /* too many colors */
 
#define REG_CANCEL   21 /* operation cancelled */
 
#define REG_ATOI   101 /* convert error-code name to number */
 
#define REG_ITOA   102 /* convert error-code number to name */
 
#define REG_PREFIX   (-1) /* identified a common prefix */
 
#define REG_EXACT   (-2) /* identified an exact match */
 

Typedefs

typedef long regoff_t
 

Functions

int pg_regcomp (regex_t *, const pg_wchar *, size_t, int, Oid)
 
int pg_regexec (regex_t *, const pg_wchar *, size_t, size_t, rm_detail_t *, size_t, regmatch_t[], int)
 
int pg_regprefix (regex_t *, pg_wchar **, size_t *)
 
void pg_regfree (regex_t *)
 
size_t pg_regerror (int, const regex_t *, char *, size_t)
 
regex_tRE_compile_and_cache (text *text_re, int cflags, Oid collation)
 
bool RE_compile_and_execute (text *text_re, char *dat, int dat_len, int cflags, Oid collation, int nmatch, regmatch_t *pmatch)
 

Macro Definition Documentation

◆ _REGEX_H_

#define _REGEX_H_   /* never again */

Definition at line 2 of file regex.h.

◆ REG_ADVANCED

#define REG_ADVANCED   000003 /* AREs (which are also EREs) */

Definition at line 103 of file regex.h.

◆ REG_ADVF

#define REG_ADVF   000002 /* advanced features in EREs */

Definition at line 102 of file regex.h.

◆ REG_ASSERT

#define REG_ASSERT   15 /* "can't happen" -- you found a bug */

Definition at line 151 of file regex.h.

◆ REG_ATOI

#define REG_ATOI   101 /* convert error-code name to number */

Definition at line 159 of file regex.h.

◆ REG_BADBR

#define REG_BADBR   10 /* invalid repetition count(s) */

Definition at line 147 of file regex.h.

◆ REG_BADOPT

#define REG_BADOPT   18 /* invalid embedded option */

Definition at line 154 of file regex.h.

◆ REG_BADPAT

#define REG_BADPAT   2 /* invalid regexp */

Definition at line 139 of file regex.h.

◆ REG_BADRPT

#define REG_BADRPT   13 /* quantifier operand invalid */

Definition at line 150 of file regex.h.

◆ REG_BASIC

#define REG_BASIC   000000 /* BREs (convenience) */

Definition at line 100 of file regex.h.

◆ REG_BOSONLY

#define REG_BOSONLY   002000 /* temporary kludge for BOS-only matches */

Definition at line 114 of file regex.h.

◆ REG_CANCEL

#define REG_CANCEL   21 /* operation cancelled */

Definition at line 157 of file regex.h.

◆ REG_DUMP

#define REG_DUMP   004000 /* none of your business :-) */

Definition at line 115 of file regex.h.

◆ REG_EBRACE

#define REG_EBRACE   9 /* braces {} not balanced */

Definition at line 146 of file regex.h.

◆ REG_EBRACK

#define REG_EBRACK   7 /* brackets [] not balanced */

Definition at line 144 of file regex.h.

◆ REG_ECOLLATE

#define REG_ECOLLATE   3 /* invalid collating element */

Definition at line 140 of file regex.h.

◆ REG_ECOLORS

#define REG_ECOLORS   20 /* too many colors */

Definition at line 156 of file regex.h.

◆ REG_ECTYPE

#define REG_ECTYPE   4 /* invalid character class */

Definition at line 141 of file regex.h.

◆ REG_EESCAPE

#define REG_EESCAPE   5 /* invalid escape \ sequence */

Definition at line 142 of file regex.h.

◆ REG_EPAREN

#define REG_EPAREN   8 /* parentheses () not balanced */

Definition at line 145 of file regex.h.

◆ REG_ERANGE

#define REG_ERANGE   11 /* invalid character range */

Definition at line 148 of file regex.h.

◆ REG_ESPACE

#define REG_ESPACE   12 /* out of memory */

Definition at line 149 of file regex.h.

◆ REG_ESUBREG

#define REG_ESUBREG   6 /* invalid backreference number */

Definition at line 143 of file regex.h.

◆ REG_ETOOBIG

#define REG_ETOOBIG   19 /* regular expression is too complex */

Definition at line 155 of file regex.h.

◆ REG_EXACT

#define REG_EXACT   (-2) /* identified an exact match */

Definition at line 163 of file regex.h.

◆ REG_EXPANDED

#define REG_EXPANDED   000040 /* expanded format, white space & comments */

Definition at line 108 of file regex.h.

◆ REG_EXPECT

#define REG_EXPECT   001000 /* report details on partial/limited matches */

Definition at line 113 of file regex.h.

◆ REG_EXTENDED

#define REG_EXTENDED   000001 /* EREs */

Definition at line 101 of file regex.h.

◆ REG_FAKE

#define REG_FAKE   010000 /* none of your business :-) */

Definition at line 116 of file regex.h.

◆ REG_FTRACE

#define REG_FTRACE   0010 /* none of your business */

Definition at line 127 of file regex.h.

◆ REG_ICASE

#define REG_ICASE   000010 /* ignore case */

Definition at line 106 of file regex.h.

◆ REG_INVARG

#define REG_INVARG   16 /* invalid argument to regex function */

Definition at line 152 of file regex.h.

◆ REG_ITOA

#define REG_ITOA   102 /* convert error-code number to name */

Definition at line 160 of file regex.h.

◆ REG_MIXED

#define REG_MIXED   17 /* character widths of regex and string differ */

Definition at line 153 of file regex.h.

◆ REG_MTRACE

#define REG_MTRACE   0020 /* none of your business */

Definition at line 128 of file regex.h.

◆ REG_NEWLINE

#define REG_NEWLINE   000300 /* newlines are line terminators */

Definition at line 111 of file regex.h.

◆ REG_NLANCH

#define REG_NLANCH   000200 /* ^ matches after \n, $ before */

Definition at line 110 of file regex.h.

◆ REG_NLSTOP

#define REG_NLSTOP   000100 /* \n doesn't match . or [^ ] */

Definition at line 109 of file regex.h.

◆ REG_NOMATCH

#define REG_NOMATCH   1 /* failed to match */

Definition at line 138 of file regex.h.

◆ REG_NOSPEC

#define REG_NOSPEC   REG_QUOTE /* historical synonym */

Definition at line 105 of file regex.h.

◆ REG_NOSUB

#define REG_NOSUB   000020 /* caller doesn't need subexpr match data */

Definition at line 107 of file regex.h.

◆ REG_NOTBOL

#define REG_NOTBOL   0001 /* BOS is not BOL */

Definition at line 124 of file regex.h.

◆ REG_NOTEOL

#define REG_NOTEOL   0002 /* EOS is not EOL */

Definition at line 125 of file regex.h.

◆ REG_OKAY

#define REG_OKAY   0 /* no errors detected */

Definition at line 137 of file regex.h.

◆ REG_PEND

#define REG_PEND   000400 /* ugh -- backward-compatibility hack */

Definition at line 112 of file regex.h.

◆ REG_PREFIX

#define REG_PREFIX   (-1) /* identified a common prefix */

Definition at line 162 of file regex.h.

◆ REG_PROGRESS

#define REG_PROGRESS   020000 /* none of your business :-) */

Definition at line 117 of file regex.h.

◆ REG_QUOTE

#define REG_QUOTE   000004 /* no special characters, none */

Definition at line 104 of file regex.h.

◆ REG_SMALL

#define REG_SMALL   0040 /* none of your business */

Definition at line 129 of file regex.h.

◆ REG_STARTEND

#define REG_STARTEND   0004 /* backward compatibility kludge */

Definition at line 126 of file regex.h.

◆ REG_UBACKREF

#define REG_UBACKREF   000001 /* has back-reference (\n) */

Definition at line 60 of file regex.h.

◆ REG_UBBS

#define REG_UBBS   000100 /* has backslash within bracket expr */

Definition at line 66 of file regex.h.

◆ REG_UBOUNDS

#define REG_UBOUNDS   000004 /* has bounded quantifier ({m,n}) */

Definition at line 62 of file regex.h.

◆ REG_UBRACES

#define REG_UBRACES   000010 /* has { that doesn't begin a quantifier */

Definition at line 63 of file regex.h.

◆ REG_UBSALNUM

#define REG_UBSALNUM   000020 /* has backslash-alphanumeric in non-ARE */

Definition at line 64 of file regex.h.

◆ REG_UEMPTYMATCH

#define REG_UEMPTYMATCH   004000 /* can match a zero-length string */

Definition at line 71 of file regex.h.

◆ REG_UIMPOSSIBLE

#define REG_UIMPOSSIBLE   010000 /* provably cannot match anything */

Definition at line 72 of file regex.h.

◆ REG_ULOCALE

#define REG_ULOCALE   002000 /* has locale dependency */

Definition at line 70 of file regex.h.

◆ REG_ULOOKAROUND

#define REG_ULOOKAROUND   000002 /* has lookahead/lookbehind constraint */

Definition at line 61 of file regex.h.

◆ REG_UNONPOSIX

#define REG_UNONPOSIX   000200 /* has any construct that extends POSIX */

Definition at line 67 of file regex.h.

◆ REG_UPBOTCH

#define REG_UPBOTCH
Value:
000040 /* has unmatched right paren in ERE (legal
* per spec, but that was a mistake) */

Definition at line 65 of file regex.h.

◆ REG_USHORTEST

#define REG_USHORTEST   020000 /* has non-greedy quantifier */

Definition at line 73 of file regex.h.

◆ REG_UUNPORT

#define REG_UUNPORT   001000 /* has numeric character code dependency */

Definition at line 69 of file regex.h.

◆ REG_UUNSPEC

#define REG_UUNSPEC
Value:
000400 /* has any case disallowed by POSIX, e.g.
* an empty branch */

Definition at line 68 of file regex.h.

Typedef Documentation

◆ regoff_t

typedef long regoff_t

Definition at line 48 of file regex.h.

Function Documentation

◆ pg_regcomp()

int pg_regcomp ( regex_t re,
const pg_wchar string,
size_t  len,
int  flags,
Oid  collation 
)

Definition at line 328 of file regcomp.c.

333 {
334  struct vars var;
335  struct vars *v = &var;
336  struct guts *g;
337  int i;
338  size_t j;
339 
340 #ifdef REG_DEBUG
341  FILE *debug = (flags & REG_PROGRESS) ? stdout : (FILE *) NULL;
342 #else
343  FILE *debug = (FILE *) NULL;
344 #endif
345 
346 #define CNOERR() { if (ISERR()) return freev(v, v->err); }
347 
348  /* sanity checks */
349 
350  if (re == NULL || string == NULL)
351  return REG_INVARG;
352  if ((flags & REG_QUOTE) &&
353  (flags & (REG_ADVANCED | REG_EXPANDED | REG_NEWLINE)))
354  return REG_INVARG;
355  if (!(flags & REG_EXTENDED) && (flags & REG_ADVF))
356  return REG_INVARG;
357 
358  /* Initialize locale-dependent support */
359  pg_set_regex_collation(collation);
360 
361  /* initial setup (after which freev() is callable) */
362  v->re = re;
363  v->now = string;
364  v->stop = v->now + len;
365  v->err = 0;
366  v->cflags = flags;
367  v->nsubexp = 0;
368  v->subs = v->sub10;
369  v->nsubs = 10;
370  for (j = 0; j < v->nsubs; j++)
371  v->subs[j] = NULL;
372  v->nfa = NULL;
373  v->cm = NULL;
374  v->nlcolor = COLORLESS;
375  v->wordchrs = NULL;
376  v->tree = NULL;
377  v->treechain = NULL;
378  v->treefree = NULL;
379  v->cv = NULL;
380  v->cv2 = NULL;
381  v->lacons = NULL;
382  v->nlacons = 0;
383  v->spaceused = 0;
384  re->re_magic = REMAGIC;
385  re->re_info = 0; /* bits get set during parse */
386  re->re_csize = sizeof(chr);
387  re->re_collation = collation;
388  re->re_guts = NULL;
389  re->re_fns = VS(&functions);
390 
391  /* more complex setup, malloced things */
392  re->re_guts = VS(MALLOC(sizeof(struct guts)));
393  if (re->re_guts == NULL)
394  return freev(v, REG_ESPACE);
395  g = (struct guts *) re->re_guts;
396  g->tree = NULL;
397  initcm(v, &g->cmap);
398  v->cm = &g->cmap;
399  g->lacons = NULL;
400  g->nlacons = 0;
401  ZAPCNFA(g->search);
402  v->nfa = newnfa(v, v->cm, (struct nfa *) NULL);
403  CNOERR();
404  /* set up a reasonably-sized transient cvec for getcvec usage */
405  v->cv = newcvec(100, 20);
406  if (v->cv == NULL)
407  return freev(v, REG_ESPACE);
408 
409  /* parsing */
410  lexstart(v); /* also handles prefixes */
411  if ((v->cflags & REG_NLSTOP) || (v->cflags & REG_NLANCH))
412  {
413  /* assign newline a unique color */
414  v->nlcolor = subcolor(v->cm, newline());
415  okcolors(v->nfa, v->cm);
416  }
417  CNOERR();
418  v->tree = parse(v, EOS, PLAIN, v->nfa->init, v->nfa->final);
419  assert(SEE(EOS)); /* even if error; ISERR() => SEE(EOS) */
420  CNOERR();
421  assert(v->tree != NULL);
422 
423  /* finish setup of nfa and its subre tree */
424  specialcolors(v->nfa);
425  CNOERR();
426 #ifdef REG_DEBUG
427  if (debug != NULL)
428  {
429  fprintf(debug, "\n\n\n========= RAW ==========\n");
430  dumpnfa(v->nfa, debug);
431  dumpst(v->tree, debug, 1);
432  }
433 #endif
434  if (v->cflags & REG_NOSUB)
435  removecaptures(v, v->tree);
436  v->ntree = numst(v->tree, 1);
437  markst(v->tree);
438  cleanst(v);
439 #ifdef REG_DEBUG
440  if (debug != NULL)
441  {
442  fprintf(debug, "\n\n\n========= TREE FIXED ==========\n");
443  dumpst(v->tree, debug, 1);
444  }
445 #endif
446 
447  /* build compacted NFAs for tree and lacons */
448  re->re_info |= nfatree(v, v->tree, debug);
449  CNOERR();
450  assert(v->nlacons == 0 || v->lacons != NULL);
451  for (i = 1; i < v->nlacons; i++)
452  {
453  struct subre *lasub = &v->lacons[i];
454 
455 #ifdef REG_DEBUG
456  if (debug != NULL)
457  fprintf(debug, "\n\n\n========= LA%d ==========\n", i);
458 #endif
459 
460  /* Prepend .* to pattern if it's a lookbehind LACON */
461  nfanode(v, lasub, !LATYPE_IS_AHEAD(lasub->latype), debug);
462  }
463  CNOERR();
464  if (v->tree->flags & SHORTER)
466 
467  /* build compacted NFAs for tree, lacons, fast search */
468 #ifdef REG_DEBUG
469  if (debug != NULL)
470  fprintf(debug, "\n\n\n========= SEARCH ==========\n");
471 #endif
472  /* can sacrifice main NFA now, so use it as work area */
473  (DISCARD) optimize(v->nfa, debug);
474  CNOERR();
475  makesearch(v, v->nfa);
476  CNOERR();
477  compact(v->nfa, &g->search);
478  CNOERR();
479 
480  /* looks okay, package it up */
481  re->re_nsub = v->nsubexp;
482  v->re = NULL; /* freev no longer frees re */
483  g->magic = GUTSMAGIC;
484  g->cflags = v->cflags;
485  g->info = re->re_info;
486  g->nsub = re->re_nsub;
487  g->tree = v->tree;
488  v->tree = NULL;
489  g->ntree = v->ntree;
490  g->compare = (v->cflags & REG_ICASE) ? casecmp : cmp;
491  g->lacons = v->lacons;
492  v->lacons = NULL;
493  g->nlacons = v->nlacons;
494 
495 #ifdef REG_DEBUG
496  if (flags & REG_DUMP)
497  {
498  dump(re, stdout);
499  fflush(stdout);
500  }
501 #endif
502 
503  assert(v->err == 0);
504  return freev(v, 0);
505 }
static bool debug
Definition: initdb.c:141
int j
Definition: isn.c:74
int i
Definition: isn.c:73
static void const char fflush(stdout)
const void size_t len
#define fprintf
Definition: port.h:226
char string[11]
Definition: preproc-type.c:46
void pg_set_regex_collation(Oid collation)
#define NOTE(b)
Definition: regcomp.c:281
static void removecaptures(struct vars *, struct subre *)
Definition: regcomp.c:2174
static void lexstart(struct vars *)
static void okcolors(struct nfa *, struct colormap *)
static void specialcolors(struct nfa *)
static long optimize(struct nfa *, FILE *)
static long nfatree(struct vars *, struct subre *, FILE *)
Definition: regcomp.c:2287
static struct subre * parse(struct vars *, int, int, struct state *, struct state *)
Definition: regcomp.c:673
static const struct fns functions
Definition: regcomp.c:313
static struct nfa * newnfa(struct vars *, struct colormap *, struct nfa *)
static void makesearch(struct vars *, struct nfa *)
Definition: regcomp.c:577
static void cleanst(struct vars *)
Definition: regcomp.c:2268
static int freev(struct vars *, int)
Definition: regcomp.c:548
#define SEE(t)
Definition: regcomp.c:270
static void initcm(struct vars *, struct colormap *)
static int casecmp(const chr *, const chr *, size_t)
#define CNOERR()
static chr newline(void)
static color subcolor(struct colormap *, chr)
static struct cvec * newcvec(int, int)
#define EOS
Definition: regcomp.c:286
static long nfanode(struct vars *, struct subre *, int, FILE *)
Definition: regcomp.c:2307
static int cmp(const chr *, const chr *, size_t)
static int numst(struct subre *, int)
Definition: regcomp.c:2220
#define PLAIN
Definition: regcomp.c:287
static void dumpnfa(struct nfa *, FILE *)
static void markst(struct subre *)
Definition: regcomp.c:2253
static void compact(struct nfa *, struct cnfa *)
#define MALLOC(n)
Definition: regcustom.h:60
pg_wchar chr
Definition: regcustom.h:66
#define assert(x)
Definition: regcustom.h:63
#define REG_ICASE
Definition: regex.h:106
#define REG_DUMP
Definition: regex.h:115
#define REG_PROGRESS
Definition: regex.h:117
#define REG_ADVANCED
Definition: regex.h:103
#define REG_EXPANDED
Definition: regex.h:108
#define REG_NLANCH
Definition: regex.h:110
#define REG_INVARG
Definition: regex.h:152
#define REG_EXTENDED
Definition: regex.h:101
#define REG_NLSTOP
Definition: regex.h:109
#define REG_ADVF
Definition: regex.h:102
#define REG_NEWLINE
Definition: regex.h:111
#define REG_NOSUB
Definition: regex.h:107
#define REG_USHORTEST
Definition: regex.h:73
#define REG_ESPACE
Definition: regex.h:149
#define REG_QUOTE
Definition: regex.h:104
#define ZAPCNFA(cnfa)
Definition: regguts.h:429
#define REMAGIC
Definition: regguts.h:96
#define GUTSMAGIC
Definition: regguts.h:530
#define COLORLESS
Definition: regguts.h:153
#define LATYPE_IS_AHEAD(la)
Definition: regguts.h:104
#define DISCARD
Definition: regguts.h:58
#define VS(x)
Definition: regguts.h:61
#define SHORTER
Definition: regguts.h:476
Definition: regguts.h:528
struct subre * tree
Definition: regguts.h:534
struct subre * lacons
Definition: regguts.h:539
int magic
Definition: regguts.h:529
long info
Definition: regguts.h:532
struct cnfa search
Definition: regguts.h:535
int ntree
Definition: regguts.h:536
int cflags
Definition: regguts.h:531
size_t nsub
Definition: regguts.h:533
int nlacons
Definition: regguts.h:540
struct colormap cmap
Definition: regguts.h:537
Definition: regguts.h:344
struct state * final
Definition: regguts.h:347
struct state * init
Definition: regguts.h:346
char * re_guts
Definition: regex.h:78
long re_info
Definition: regex.h:59
int re_csize
Definition: regex.h:74
size_t re_nsub
Definition: regex.h:58
int re_magic
Definition: regex.h:57
Oid re_collation
Definition: regex.h:76
char * re_fns
Definition: regex.h:79
Definition: regguts.h:472
char flags
Definition: regguts.h:474
char latype
Definition: regguts.h:490
Definition: regcomp.c:238
const chr * now
Definition: regcomp.c:240
struct colormap * cm
Definition: regcomp.c:253
struct subre * tree
Definition: regcomp.c:256
struct subre ** subs
Definition: regcomp.c:249
int nlacons
Definition: regcomp.c:263
const chr * stop
Definition: regcomp.c:241
struct subre * lacons
Definition: regcomp.c:262
size_t spaceused
Definition: regcomp.c:265
int err
Definition: regcomp.c:242
int cflags
Definition: regcomp.c:243
struct subre * treechain
Definition: regcomp.c:257
int ntree
Definition: regcomp.c:259
regex_t * re
Definition: regcomp.c:239
struct subre * sub10[10]
Definition: regcomp.c:251
struct cvec * cv2
Definition: regcomp.c:261
struct subre * treefree
Definition: regcomp.c:258
struct nfa * nfa
Definition: regcomp.c:252
size_t nsubs
Definition: regcomp.c:250
struct state * wordchrs
Definition: regcomp.c:255
int nsubexp
Definition: regcomp.c:248
struct cvec * cv
Definition: regcomp.c:260
color nlcolor
Definition: regcomp.c:254

References assert, casecmp(), vars::cflags, guts::cflags, cleanst(), vars::cm, guts::cmap, cmp(), CNOERR, COLORLESS, compact(), vars::cv, vars::cv2, debug, DISCARD, dumpnfa(), EOS, vars::err, fflush(), nfa::final, subre::flags, fprintf, freev(), functions, GUTSMAGIC, i, guts::info, nfa::init, initcm(), j, vars::lacons, guts::lacons, subre::latype, LATYPE_IS_AHEAD, len, lexstart(), guts::magic, makesearch(), MALLOC, markst(), newcvec(), newline(), newnfa(), vars::nfa, nfanode(), nfatree(), vars::nlacons, guts::nlacons, vars::nlcolor, NOTE, vars::now, guts::nsub, vars::nsubexp, vars::nsubs, vars::ntree, guts::ntree, numst(), okcolors(), optimize(), parse(), pg_set_regex_collation(), PLAIN, vars::re, regex_t::re_collation, regex_t::re_csize, regex_t::re_fns, regex_t::re_guts, regex_t::re_info, regex_t::re_magic, regex_t::re_nsub, REG_ADVANCED, REG_ADVF, REG_DUMP, REG_ESPACE, REG_EXPANDED, REG_EXTENDED, REG_ICASE, REG_INVARG, REG_NEWLINE, REG_NLANCH, REG_NLSTOP, REG_NOSUB, REG_PROGRESS, REG_QUOTE, REG_USHORTEST, REMAGIC, removecaptures(), guts::search, SEE, SHORTER, vars::spaceused, specialcolors(), generate_unaccent_rules::stdout, vars::stop, vars::sub10, subcolor(), vars::subs, vars::tree, guts::tree, vars::treechain, vars::treefree, VS, vars::wordchrs, and ZAPCNFA.

Referenced by NIAddAffix(), parse_ident_line(), RE_compile(), RE_compile_and_cache(), and test_re_compile().

◆ pg_regerror()

size_t pg_regerror ( int  errcode,
const regex_t preg,
char *  errbuf,
size_t  errbuf_size 
)

Definition at line 60 of file regerror.c.

64 {
65  const struct rerr *r;
66  const char *msg;
67  char convbuf[sizeof(unk) + 50]; /* 50 = plenty for int */
68  size_t len;
69  int icode;
70 
71  switch (errcode)
72  {
73  case REG_ATOI: /* convert name to number */
74  for (r = rerrs; r->code >= 0; r++)
75  if (strcmp(r->name, errbuf) == 0)
76  break;
77  sprintf(convbuf, "%d", r->code); /* -1 for unknown */
78  msg = convbuf;
79  break;
80  case REG_ITOA: /* convert number to name */
81  icode = atoi(errbuf); /* not our problem if this fails */
82  for (r = rerrs; r->code >= 0; r++)
83  if (r->code == icode)
84  break;
85  if (r->code >= 0)
86  msg = r->name;
87  else
88  { /* unknown; tell him the number */
89  sprintf(convbuf, "REG_%u", (unsigned) icode);
90  msg = convbuf;
91  }
92  break;
93  default: /* a real, normal error code */
94  for (r = rerrs; r->code >= 0; r++)
95  if (r->code == errcode)
96  break;
97  if (r->code >= 0)
98  msg = r->explain;
99  else
100  { /* unknown; say so */
101  sprintf(convbuf, unk, errcode);
102  msg = convbuf;
103  }
104  break;
105  }
106 
107  len = strlen(msg) + 1; /* space needed, including NUL */
108  if (errbuf_size > 0)
109  {
110  if (errbuf_size > len)
111  strcpy(errbuf, msg);
112  else
113  { /* truncate to fit */
114  memcpy(errbuf, msg, errbuf_size - 1);
115  errbuf[errbuf_size - 1] = '\0';
116  }
117  }
118 
119  return len;
120 }
int errcode(int sqlerrcode)
Definition: elog.c:698
#define sprintf
Definition: port.h:224
static const struct rerr rerrs[]
static const char unk[]
Definition: regerror.c:37
#define REG_ITOA
Definition: regex.h:160
#define REG_ATOI
Definition: regex.h:159
Definition: regerror.c:41
const char * explain
Definition: regerror.c:44
int code
Definition: regerror.c:42
const char * name
Definition: regerror.c:43

References rerr::code, errcode(), rerr::explain, len, rerr::name, REG_ATOI, REG_ITOA, rerrs, sprintf, and unk.

Referenced by check_ident_usermap(), NIAddAffix(), parse_ident_line(), RE_compile(), RE_compile_and_cache(), RE_wchar_execute(), regexp_fixed_prefix(), replace_text_regexp(), test_re_compile(), and test_re_execute().

◆ pg_regexec()

int pg_regexec ( regex_t re,
const pg_wchar string,
size_t  len,
size_t  search_start,
rm_detail_t details,
size_t  nmatch,
regmatch_t  pmatch[],
int  flags 
)

Definition at line 176 of file regexec.c.

184 {
185  struct vars var;
186  register struct vars *v = &var;
187  int st;
188  size_t n;
189  size_t i;
190  int backref;
191 
192 #define LOCALMAT 20
193  regmatch_t mat[LOCALMAT];
194 
195 #define LOCALDFAS 40
196  struct dfa *subdfas[LOCALDFAS];
197 
198  /* sanity checks */
199  if (re == NULL || string == NULL || re->re_magic != REMAGIC)
200  return REG_INVARG;
201  if (re->re_csize != sizeof(chr))
202  return REG_MIXED;
203  if (search_start > len)
204  return REG_NOMATCH;
205 
206  /* Initialize locale-dependent support */
208 
209  /* setup */
210  v->re = re;
211  v->g = (struct guts *) re->re_guts;
212  if ((v->g->cflags & REG_EXPECT) && details == NULL)
213  return REG_INVARG;
214  if (v->g->info & REG_UIMPOSSIBLE)
215  return REG_NOMATCH;
216  backref = (v->g->info & REG_UBACKREF) ? 1 : 0;
217  v->eflags = flags;
218  if (backref && nmatch <= v->g->nsub)
219  {
220  /* need larger work area */
221  v->nmatch = v->g->nsub + 1;
222  if (v->nmatch <= LOCALMAT)
223  v->pmatch = mat;
224  else
225  v->pmatch = (regmatch_t *) MALLOC(v->nmatch * sizeof(regmatch_t));
226  if (v->pmatch == NULL)
227  return REG_ESPACE;
228  zapallsubs(v->pmatch, v->nmatch);
229  }
230  else
231  {
232  /* we can store results directly in caller's array */
233  v->pmatch = pmatch;
234  /* ensure any extra entries in caller's array are filled with -1 */
235  if (nmatch > 0)
236  zapallsubs(pmatch, nmatch);
237  /* then forget about extra entries, to avoid useless work in find() */
238  if (nmatch > v->g->nsub + 1)
239  nmatch = v->g->nsub + 1;
240  v->nmatch = nmatch;
241  }
242  v->details = details;
243  v->start = (chr *) string;
244  v->search_start = (chr *) string + search_start;
245  v->stop = (chr *) string + len;
246  v->err = 0;
247  v->subdfas = NULL;
248  v->ladfas = NULL;
249  v->lblastcss = NULL;
250  v->lblastcp = NULL;
251  /* below this point, "goto cleanup" will behave sanely */
252 
253  assert(v->g->ntree >= 0);
254  n = (size_t) v->g->ntree;
255  if (n <= LOCALDFAS)
256  v->subdfas = subdfas;
257  else
258  {
259  v->subdfas = (struct dfa **) MALLOC(n * sizeof(struct dfa *));
260  if (v->subdfas == NULL)
261  {
262  st = REG_ESPACE;
263  goto cleanup;
264  }
265  }
266  for (i = 0; i < n; i++)
267  v->subdfas[i] = NULL;
268 
269  assert(v->g->nlacons >= 0);
270  n = (size_t) v->g->nlacons;
271  if (n > 0)
272  {
273  v->ladfas = (struct dfa **) MALLOC(n * sizeof(struct dfa *));
274  if (v->ladfas == NULL)
275  {
276  st = REG_ESPACE;
277  goto cleanup;
278  }
279  for (i = 0; i < n; i++)
280  v->ladfas[i] = NULL;
281  v->lblastcss = (struct sset **) MALLOC(n * sizeof(struct sset *));
282  v->lblastcp = (chr **) MALLOC(n * sizeof(chr *));
283  if (v->lblastcss == NULL || v->lblastcp == NULL)
284  {
285  st = REG_ESPACE;
286  goto cleanup;
287  }
288  for (i = 0; i < n; i++)
289  {
290  v->lblastcss[i] = NULL;
291  v->lblastcp[i] = NULL;
292  }
293  }
294 
295  /* do it */
296  assert(v->g->tree != NULL);
297  if (backref)
298  st = cfind(v, &v->g->tree->cnfa, &v->g->cmap);
299  else
300  st = find(v, &v->g->tree->cnfa, &v->g->cmap);
301 
302  /* on success, ensure caller's match vector is filled correctly */
303  if (st == REG_OKAY && nmatch > 0)
304  {
305  if (v->pmatch != pmatch)
306  {
307  /* copy portion of match vector over from (larger) work area */
308  assert(nmatch <= v->nmatch);
309  memcpy(VS(pmatch), VS(v->pmatch), nmatch * sizeof(regmatch_t));
310  }
311  if (v->g->cflags & REG_NOSUB)
312  {
313  /* don't expose possibly-partial sub-match results to caller */
314  zapallsubs(pmatch, nmatch);
315  }
316  }
317 
318  /* clean up */
319 cleanup:
320  if (v->pmatch != pmatch && v->pmatch != mat)
321  FREE(v->pmatch);
322  if (v->subdfas != NULL)
323  {
324  n = (size_t) v->g->ntree;
325  for (i = 0; i < n; i++)
326  {
327  if (v->subdfas[i] != NULL)
328  freedfa(v->subdfas[i]);
329  }
330  if (v->subdfas != subdfas)
331  FREE(v->subdfas);
332  }
333  if (v->ladfas != NULL)
334  {
335  n = (size_t) v->g->nlacons;
336  for (i = 0; i < n; i++)
337  {
338  if (v->ladfas[i] != NULL)
339  freedfa(v->ladfas[i]);
340  }
341  FREE(v->ladfas);
342  }
343  if (v->lblastcss != NULL)
344  FREE(v->lblastcss);
345  if (v->lblastcp != NULL)
346  FREE(v->lblastcp);
347 
348 #ifdef REG_DEBUG
349  if (v->eflags & (REG_FTRACE | REG_MTRACE))
350  fflush(stdout);
351 #endif
352 
353  return st;
354 }
static void cleanup(void)
Definition: bootstrap.c:697
#define FREE(ptr)
Definition: cryptohash.c:37
#define REG_NOMATCH
Definition: regex.h:138
#define REG_UIMPOSSIBLE
Definition: regex.h:72
#define REG_MTRACE
Definition: regex.h:128
#define REG_FTRACE
Definition: regex.h:127
#define REG_EXPECT
Definition: regex.h:113
#define REG_OKAY
Definition: regex.h:137
#define REG_MIXED
Definition: regex.h:153
#define REG_UBACKREF
Definition: regex.h:60
static void freedfa(struct dfa *)
#define LOCALMAT
static void zapallsubs(regmatch_t *, size_t)
Definition: regexec.c:654
static int cfind(struct vars *, struct cnfa *, struct colormap *)
Definition: regexec.c:500
static int find(struct vars *, struct cnfa *, struct colormap *)
Definition: regexec.c:410
#define LOCALDFAS
Definition: regexec.c:64
Definition: regexec.c:46
struct cnfa cnfa
Definition: regguts.h:500
size_t nmatch
Definition: regexec.c:111
struct dfa ** ladfas
Definition: regexec.c:119
struct dfa ** subdfas
Definition: regexec.c:118
chr * search_start
Definition: regexec.c:115
struct sset ** lblastcss
Definition: regexec.c:120
struct guts * g
Definition: regexec.c:109
chr ** lblastcp
Definition: regexec.c:121
int eflags
Definition: regexec.c:110
chr * start
Definition: regexec.c:114
rm_detail_t * details
Definition: regexec.c:113
regmatch_t * pmatch
Definition: regexec.c:112

References assert, cfind(), guts::cflags, cleanup(), guts::cmap, subre::cnfa, vars::details, vars::eflags, vars::err, fflush(), find(), FREE, freedfa(), vars::g, i, if(), guts::info, vars::ladfas, vars::lblastcp, vars::lblastcss, len, LOCALDFAS, LOCALMAT, MALLOC, guts::nlacons, vars::nmatch, guts::nsub, guts::ntree, pg_set_regex_collation(), vars::pmatch, vars::re, regex_t::re_collation, regex_t::re_csize, regex_t::re_guts, regex_t::re_magic, REG_ESPACE, REG_EXPECT, REG_FTRACE, REG_INVARG, REG_MIXED, REG_MTRACE, REG_NOMATCH, REG_NOSUB, REG_OKAY, REG_UBACKREF, REG_UIMPOSSIBLE, REMAGIC, vars::search_start, vars::start, generate_unaccent_rules::stdout, vars::stop, vars::subdfas, guts::tree, VS, and zapallsubs().

Referenced by check_ident_usermap(), CheckAffix(), RE_wchar_execute(), replace_text_regexp(), and test_re_execute().

◆ pg_regfree()

void pg_regfree ( regex_t re)

Definition at line 49 of file regfree.c.

50 {
51  if (re == NULL)
52  return;
53  (*((struct fns *) re->re_fns)->free) (re);
54 }
Definition: regguts.h:511

References regex_t::re_fns.

Referenced by createTrgmNFA(), load_ident(), RE_compile_and_cache(), regex_affix_deletion_callback(), and test_regex().

◆ pg_regprefix()

int pg_regprefix ( regex_t re,
pg_wchar **  string,
size_t *  slength 
)

Definition at line 46 of file regprefix.c.

49 {
50  struct guts *g;
51  struct cnfa *cnfa;
52  int st;
53 
54  /* sanity checks */
55  if (string == NULL || slength == NULL)
56  return REG_INVARG;
57  *string = NULL; /* initialize for failure cases */
58  *slength = 0;
59  if (re == NULL || re->re_magic != REMAGIC)
60  return REG_INVARG;
61  if (re->re_csize != sizeof(chr))
62  return REG_MIXED;
63 
64  /* Initialize locale-dependent support */
66 
67  /* setup */
68  g = (struct guts *) re->re_guts;
69  if (g->info & REG_UIMPOSSIBLE)
70  return REG_NOMATCH;
71 
72  /*
73  * This implementation considers only the search NFA for the topmost regex
74  * tree node. Therefore, constraints such as backrefs are not fully
75  * applied, which is allowed per the function's API spec.
76  */
77  assert(g->tree != NULL);
78  cnfa = &g->tree->cnfa;
79 
80  /* matchall NFAs never have a fixed prefix */
81  if (cnfa->flags & MATCHALL)
82  return REG_NOMATCH;
83 
84  /*
85  * Since a correct NFA should never contain any exit-free loops, it should
86  * not be possible for our traversal to return to a previously visited NFA
87  * state. Hence we need at most nstates chrs in the output string.
88  */
89  *string = (chr *) MALLOC(cnfa->nstates * sizeof(chr));
90  if (*string == NULL)
91  return REG_ESPACE;
92 
93  /* do it */
94  st = findprefix(cnfa, &g->cmap, *string, slength);
95 
96  assert(*slength <= cnfa->nstates);
97 
98  /* clean up */
99  if (st != REG_PREFIX && st != REG_EXACT)
100  {
101  FREE(*string);
102  *string = NULL;
103  *slength = 0;
104  }
105 
106  return st;
107 }
#define REG_EXACT
Definition: regex.h:163
#define REG_PREFIX
Definition: regex.h:162
#define MATCHALL
Definition: regguts.h:407
static int findprefix(struct cnfa *cnfa, struct colormap *cm, chr *string, size_t *slength)
Definition: regprefix.c:116
Definition: regguts.h:402
int flags
Definition: regguts.h:405
int nstates
Definition: regguts.h:403

References assert, guts::cmap, subre::cnfa, findprefix(), cnfa::flags, FREE, if(), guts::info, MALLOC, MATCHALL, cnfa::nstates, pg_set_regex_collation(), regex_t::re_collation, regex_t::re_csize, regex_t::re_guts, regex_t::re_magic, REG_ESPACE, REG_EXACT, REG_INVARG, REG_MIXED, REG_NOMATCH, REG_PREFIX, REG_UIMPOSSIBLE, REMAGIC, and guts::tree.

Referenced by regexp_fixed_prefix().

◆ RE_compile_and_cache()

regex_t* RE_compile_and_cache ( text text_re,
int  cflags,
Oid  collation 
)

Definition at line 138 of file regexp.c.

139 {
140  int text_re_len = VARSIZE_ANY_EXHDR(text_re);
141  char *text_re_val = VARDATA_ANY(text_re);
142  pg_wchar *pattern;
143  int pattern_len;
144  int i;
145  int regcomp_result;
146  cached_re_str re_temp;
147  char errMsg[100];
148 
149  /*
150  * Look for a match among previously compiled REs. Since the data
151  * structure is self-organizing with most-used entries at the front, our
152  * search strategy can just be to scan from the front.
153  */
154  for (i = 0; i < num_res; i++)
155  {
156  if (re_array[i].cre_pat_len == text_re_len &&
157  re_array[i].cre_flags == cflags &&
158  re_array[i].cre_collation == collation &&
159  memcmp(re_array[i].cre_pat, text_re_val, text_re_len) == 0)
160  {
161  /*
162  * Found a match; move it to front if not there already.
163  */
164  if (i > 0)
165  {
166  re_temp = re_array[i];
167  memmove(&re_array[1], &re_array[0], i * sizeof(cached_re_str));
168  re_array[0] = re_temp;
169  }
170 
171  return &re_array[0].cre_re;
172  }
173  }
174 
175  /*
176  * Couldn't find it, so try to compile the new RE. To avoid leaking
177  * resources on failure, we build into the re_temp local.
178  */
179 
180  /* Convert pattern string to wide characters */
181  pattern = (pg_wchar *) palloc((text_re_len + 1) * sizeof(pg_wchar));
182  pattern_len = pg_mb2wchar_with_len(text_re_val,
183  pattern,
184  text_re_len);
185 
186  regcomp_result = pg_regcomp(&re_temp.cre_re,
187  pattern,
188  pattern_len,
189  cflags,
190  collation);
191 
192  pfree(pattern);
193 
194  if (regcomp_result != REG_OKAY)
195  {
196  /* re didn't compile (no need for pg_regfree, if so) */
197 
198  /*
199  * Here and in other places in this file, do CHECK_FOR_INTERRUPTS
200  * before reporting a regex error. This is so that if the regex
201  * library aborts and returns REG_CANCEL, we don't print an error
202  * message that implies the regex was invalid.
203  */
205 
206  pg_regerror(regcomp_result, &re_temp.cre_re, errMsg, sizeof(errMsg));
207  ereport(ERROR,
208  (errcode(ERRCODE_INVALID_REGULAR_EXPRESSION),
209  errmsg("invalid regular expression: %s", errMsg)));
210  }
211 
212  /*
213  * We use malloc/free for the cre_pat field because the storage has to
214  * persist across transactions, and because we want to get control back on
215  * out-of-memory. The Max() is because some malloc implementations return
216  * NULL for malloc(0).
217  */
218  re_temp.cre_pat = malloc(Max(text_re_len, 1));
219  if (re_temp.cre_pat == NULL)
220  {
221  pg_regfree(&re_temp.cre_re);
222  ereport(ERROR,
223  (errcode(ERRCODE_OUT_OF_MEMORY),
224  errmsg("out of memory")));
225  }
226  memcpy(re_temp.cre_pat, text_re_val, text_re_len);
227  re_temp.cre_pat_len = text_re_len;
228  re_temp.cre_flags = cflags;
229  re_temp.cre_collation = collation;
230 
231  /*
232  * Okay, we have a valid new item in re_temp; insert it into the storage
233  * array. Discard last entry if needed.
234  */
235  if (num_res >= MAX_CACHED_RES)
236  {
237  --num_res;
239  pg_regfree(&re_array[num_res].cre_re);
240  free(re_array[num_res].cre_pat);
241  }
242 
243  if (num_res > 0)
244  memmove(&re_array[1], &re_array[0], num_res * sizeof(cached_re_str));
245 
246  re_array[0] = re_temp;
247  num_res++;
248 
249  return &re_array[0].cre_re;
250 }
#define Max(x, y)
Definition: c.h:980
int errmsg(const char *fmt,...)
Definition: elog.c:909
#define ERROR
Definition: elog.h:33
#define ereport(elevel,...)
Definition: elog.h:143
#define free(a)
Definition: header.h:65
#define malloc(a)
Definition: header.h:50
Assert(fmt[strlen(fmt) - 1] !='\n')
unsigned int pg_wchar
Definition: mbprint.c:31
int pg_mb2wchar_with_len(const char *from, pg_wchar *to, int len)
Definition: mbutils.c:929
void pfree(void *pointer)
Definition: mcxt.c:1169
void * palloc(Size size)
Definition: mcxt.c:1062
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:120
#define VARDATA_ANY(PTR)
Definition: postgres.h:361
#define VARSIZE_ANY_EXHDR(PTR)
Definition: postgres.h:354
int pg_regcomp(regex_t *re, const chr *string, size_t len, int flags, Oid collation)
Definition: regcomp.c:328
size_t pg_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
Definition: regerror.c:60
#define MAX_CACHED_RES
Definition: regexp.c:96
static int num_res
Definition: regexp.c:109
static cached_re_str re_array[MAX_CACHED_RES]
Definition: regexp.c:110
void pg_regfree(regex_t *re)
Definition: regfree.c:49
char * cre_pat
Definition: regexp.c:102
int cre_pat_len
Definition: regexp.c:103
regex_t cre_re
Definition: regexp.c:106
Oid cre_collation
Definition: regexp.c:105
int cre_flags
Definition: regexp.c:104

References Assert(), CHECK_FOR_INTERRUPTS, cached_re_str::cre_collation, cached_re_str::cre_flags, cached_re_str::cre_pat, cached_re_str::cre_pat_len, cached_re_str::cre_re, ereport, errcode(), errmsg(), ERROR, free, i, malloc, Max, MAX_CACHED_RES, num_res, palloc(), pfree(), pg_mb2wchar_with_len(), pg_regcomp(), pg_regerror(), pg_regfree(), re_array, REG_OKAY, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

Referenced by RE_compile_and_execute(), regexp_fixed_prefix(), replace_text_regexp(), setup_regexp_matches(), and textregexsubstr().

◆ RE_compile_and_execute()

bool RE_compile_and_execute ( text text_re,
char *  dat,
int  dat_len,
int  cflags,
Oid  collation,
int  nmatch,
regmatch_t pmatch 
)

Definition at line 344 of file regexp.c.

347 {
348  regex_t *re;
349 
350  /* Use REG_NOSUB if caller does not want sub-match details */
351  if (nmatch < 2)
352  cflags |= REG_NOSUB;
353 
354  /* Compile RE */
355  re = RE_compile_and_cache(text_re, cflags, collation);
356 
357  return RE_execute(re, dat, dat_len, nmatch, pmatch);
358 }
regex_t * RE_compile_and_cache(text *text_re, int cflags, Oid collation)
Definition: regexp.c:138
static bool RE_execute(regex_t *re, char *dat, int dat_len, int nmatch, regmatch_t *pmatch)
Definition: regexp.c:310
Definition: regex.h:56

References RE_compile_and_cache(), RE_execute(), and REG_NOSUB.

Referenced by executeLikeRegex(), nameicregexeq(), nameicregexne(), nameregexeq(), nameregexne(), regexp_like(), texticregexeq(), texticregexne(), textregexeq(), and textregexne().