Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
regexp.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/regexp.h"
#include "nvim/charset.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds2.h"
#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/garray.h"
#include "nvim/strings.h"
#include "nvim/regexp_nfa.c"

Data Structures

struct  regsave_T
 
struct  save_se_T
 
struct  regbehind_S
 
struct  regitem_S
 
struct  regstar_S
 
struct  backpos_S
 
struct  decomp_T
 
struct  regexec_T
 
struct  regsubmatch_T
 

Macros

#define END   0 /* End of program or NOMATCH operand. */
 
#define BOL   1 /* Match "" at beginning of line. */
 
#define EOL   2 /* Match "" at end of line. */
 
#define BRANCH
 
#define BACK   4 /* Match "", "next" ptr points backward. */
 
#define EXACTLY   5 /* str Match this string. */
 
#define NOTHING   6 /* Match empty string. */
 
#define STAR
 
#define PLUS
 
#define MATCH   9 /* node match the operand zero-width */
 
#define NOMATCH   10 /* node check for no match with operand */
 
#define BEHIND   11 /* node look behind for a match with operand */
 
#define NOBEHIND   12 /* node look behind for no match with operand */
 
#define SUBPAT   13 /* node match the operand here */
 
#define BRACE_SIMPLE
 
#define BOW   15 /* Match "" after [^a-zA-Z0-9_] */
 
#define EOW   16 /* Match "" at [^a-zA-Z0-9_] */
 
#define BRACE_LIMITS
 
#define NEWL   18 /* Match line-break */
 
#define BHPOS   19 /* End position for BEHIND or NOBEHIND */
 
#define ADD_NL   30
 
#define FIRST_NL   ANY + ADD_NL
 
#define ANY   20 /* Match any one character. */
 
#define ANYOF   21 /* str Match any character in this string. */
 
#define ANYBUT
 
#define IDENT   23 /* Match identifier char */
 
#define SIDENT   24 /* Match identifier char but no digit */
 
#define KWORD   25 /* Match keyword char */
 
#define SKWORD   26 /* Match word char but no digit */
 
#define FNAME   27 /* Match file name char */
 
#define SFNAME   28 /* Match file name char but no digit */
 
#define PRINT   29 /* Match printable char */
 
#define SPRINT   30 /* Match printable char but no digit */
 
#define WHITE   31 /* Match whitespace char */
 
#define NWHITE   32 /* Match non-whitespace char */
 
#define DIGIT   33 /* Match digit char */
 
#define NDIGIT   34 /* Match non-digit char */
 
#define HEX   35 /* Match hex char */
 
#define NHEX   36 /* Match non-hex char */
 
#define OCTAL   37 /* Match octal char */
 
#define NOCTAL   38 /* Match non-octal char */
 
#define WORD   39 /* Match word char */
 
#define NWORD   40 /* Match non-word char */
 
#define HEAD   41 /* Match head char */
 
#define NHEAD   42 /* Match non-head char */
 
#define ALPHA   43 /* Match alpha char */
 
#define NALPHA   44 /* Match non-alpha char */
 
#define LOWER   45 /* Match lowercase char */
 
#define NLOWER   46 /* Match non-lowercase char */
 
#define UPPER   47 /* Match uppercase char */
 
#define NUPPER   48 /* Match non-uppercase char */
 
#define LAST_NL   NUPPER + ADD_NL
 
#define WITH_NL(op)   ((op) >= FIRST_NL && (op) <= LAST_NL)
 
#define MOPEN   80
 
#define MCLOSE   90
 
#define BACKREF   100
 
#define ZOPEN   110
 
#define ZCLOSE   120
 
#define ZREF   130
 
#define BRACE_COMPLEX   140 /* -149 node Match nodes between m & n times */
 
#define NOPEN
 
#define NCLOSE   151 /* Analogous to NOPEN. */
 
#define MULTIBYTECODE   200 /* mbc Match one multi-byte character */
 
#define RE_BOF   201 /* Match "" at beginning of file. */
 
#define RE_EOF   202 /* Match "" at end of file. */
 
#define CURSOR   203 /* Match location of cursor. */
 
#define RE_LNUM   204 /* nr cmp Match line number */
 
#define RE_COL   205 /* nr cmp Match column number */
 
#define RE_VCOL   206 /* nr cmp Match virtual column number */
 
#define RE_MARK   207 /* mark cmp Match mark position */
 
#define RE_VISUAL   208 /* Match Visual area */
 
#define RE_COMPOSING   209
 
#define Magic(x)   ((int)(x) - 256)
 
#define un_Magic(x)   ((x) + 256)
 
#define is_Magic(x)   ((x) < 0)
 
#define REGMAGIC   0234
 
#define OP(p)   ((int)*(p))
 
#define NEXT(p)   (((*((p) + 1) & 0377) << 8) + (*((p) + 2) & 0377))
 
#define OPERAND(p)   ((p) + 3)
 
#define OPERAND_MIN(p)
 
#define OPERAND_MAX(p)   OPERAND_MIN((p) + 4)
 
#define OPERAND_CMP(p)   (p)[7]
 
#define UCHARAT(p)   ((int)*(char_u *)(p))
 
#define EMSG_RET_NULL(m)   return (EMSG(m), rc_did_emsg = true, (void *)NULL)
 
#define IEMSG_RET_NULL(m)   return (IEMSG(m), rc_did_emsg = true, (void *)NULL)
 
#define EMSG_RET_FAIL(m)   return (EMSG(m), rc_did_emsg = true, FAIL)
 
#define EMSG2_RET_NULL(m, c)   return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = true, (void *)NULL)
 
#define EMSG2_RET_FAIL(m, c)   return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
 
#define EMSG_ONE_RET_NULL
 
#define MAX_LIMIT   (32767L << 16L)
 
#define NOT_MULTI   0
 
#define MULTI_ONE   1
 
#define MULTI_MULT   2
 
#define HASWIDTH   0x1 /* Known never to match null string. */
 
#define SIMPLE   0x2 /* Simple enough to be STAR/PLUS operand. */
 
#define SPSTART   0x4 /* Starts with * or +. */
 
#define HASNL   0x8 /* Contains some \n. */
 
#define HASLOOKBH   0x10 /* Contains "\@<=" or "\@<!". */
 
#define WORST   0 /* Worst case. */
 
#define JUST_CALC_SIZE   ((char_u *) -1)
 
#define CLASS_ALNUM   0
 
#define CLASS_ALPHA   1
 
#define CLASS_BLANK   2
 
#define CLASS_CNTRL   3
 
#define CLASS_DIGIT   4
 
#define CLASS_GRAPH   5
 
#define CLASS_LOWER   6
 
#define CLASS_PRINT   7
 
#define CLASS_PUNCT   8
 
#define CLASS_SPACE   9
 
#define CLASS_UPPER   10
 
#define CLASS_XDIGIT   11
 
#define CLASS_TAB   12
 
#define CLASS_RETURN   13
 
#define CLASS_BACKSPACE   14
 
#define CLASS_ESCAPE   15
 
#define CLASS_NONE   99
 
#define RI_DIGIT   0x01
 
#define RI_HEX   0x02
 
#define RI_OCTAL   0x04
 
#define RI_WORD   0x08
 
#define RI_HEAD   0x10
 
#define RI_ALPHA   0x20
 
#define RI_LOWER   0x40
 
#define RI_UPPER   0x80
 
#define RI_WHITE   0x100
 
#define ri_digit(c)   (c < 0x100 && (class_tab[c] & RI_DIGIT))
 
#define ri_hex(c)   (c < 0x100 && (class_tab[c] & RI_HEX))
 
#define ri_octal(c)   (c < 0x100 && (class_tab[c] & RI_OCTAL))
 
#define ri_word(c)   (c < 0x100 && (class_tab[c] & RI_WORD))
 
#define ri_head(c)   (c < 0x100 && (class_tab[c] & RI_HEAD))
 
#define ri_alpha(c)   (c < 0x100 && (class_tab[c] & RI_ALPHA))
 
#define ri_lower(c)   (c < 0x100 && (class_tab[c] & RI_LOWER))
 
#define ri_upper(c)   (c < 0x100 && (class_tab[c] & RI_UPPER))
 
#define ri_white(c)   (c < 0x100 && (class_tab[c] & RI_WHITE))
 
#define RF_ICASE   1 /* ignore case */
 
#define RF_NOICASE   2 /* don't ignore case */
 
#define RF_HASNL   4 /* can match a NL */
 
#define RF_ICOMBINE   8 /* ignore combining characters */
 
#define RF_LOOKBH   16 /* uses "\@<=" or "\@<!" */
 
#define MAGIC_NONE   1 /* "\V" very unmagic */
 
#define MAGIC_OFF   2 /* "\M" or 'magic' off */
 
#define MAGIC_ON   3 /* "\m" or 'magic' */
 
#define MAGIC_ALL   4 /* "\v" very magic */
 
#define REG_NOPAREN   0 /* toplevel reg() */
 
#define REG_PAREN   1 /* \(\) */
 
#define REG_ZPAREN   2 /* \z(\) */
 
#define REG_NPAREN   3 /* \%(\) */
 
#define REGMBC(x)   regmbc(x);
 
#define CASEMBC(x)   case x:
 
#define save_se(savep, posp, pp)   REG_MULTI ? save_se_multi((savep), (posp)) : save_se_one((savep), (pp))
 
#define restore_se(savep, posp, pp)
 
#define REGSTACK_INITIAL   2048
 
#define BACKPOS_INITIAL   64
 
#define REG_MULTI   (rex.reg_match == NULL)
 
#define ADVANCE_REGINPUT()   MB_PTR_ADV(reginput)
 
#define RA_FAIL   1 /* something failed, abort */
 
#define RA_CONT   2 /* continue in inner loop */
 
#define RA_BREAK   3 /* break inner loop */
 
#define RA_MATCH   4 /* successful match */
 
#define RA_NOMATCH   5 /* didn't match */
 

Typedefs

typedef void(*(* fptr_T) (int *, int)
 
typedef struct regbehind_S regbehind_T
 
typedef enum regstate_E regstate_T
 
typedef struct regitem_S regitem_T
 
typedef struct regstar_S regstar_T
 
typedef struct backpos_S backpos_T
 

Enumerations

enum  regstate_E {
  RS_NOPEN = 0, RS_MOPEN, RS_MCLOSE, RS_ZOPEN,
  RS_ZCLOSE, RS_BRANCH, RS_BRCPLX_MORE, RS_BRCPLX_LONG,
  RS_BRCPLX_SHORT, RS_NOMATCH, RS_BEHIND1, RS_BEHIND2,
  RS_STAR_LONG, RS_STAR_SHORT
}
 

Functions

int re_multiline (regprog_T *prog)
 
char_uskip_regexp (char_u *startp, int dirc, int magic, char_u **newp)
 
int vim_regcomp_had_eol (void)
 
reg_extmatch_Tref_extmatch (reg_extmatch_T *em)
 
void unref_extmatch (reg_extmatch_T *em)
 
char_uregtilde (char_u *source, int magic)
 
int vim_regsub (regmatch_T *rmp, char_u *source, typval_T *expr, char_u *dest, int copy, int magic, int backslash)
 
int vim_regsub_multi (regmmatch_T *rmp, linenr_T lnum, char_u *source, char_u *dest, int copy, int magic, int backslash)
 
char_ureg_submatch (int no)
 
list_Treg_submatch_list (int no)
 
regprog_Tvim_regcomp (char_u *expr_arg, int re_flags)
 
void vim_regfree (regprog_T *prog)
 
int vim_regexec_prog (regprog_T **prog, bool ignore_case, char_u *line, colnr_T col)
 
int vim_regexec (regmatch_T *rmp, char_u *line, colnr_T col)
 
int vim_regexec_nl (regmatch_T *rmp, char_u *line, colnr_T col)
 
long vim_regexec_multi (regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm)
 

Variables

 parse_state_T
 

Macro Definition Documentation

#define ADD_NL   30
#define ADVANCE_REGINPUT ( )    MB_PTR_ADV(reginput)
#define ALPHA   43 /* Match alpha char */
#define ANY   20 /* Match any one character. */
#define ANYBUT
Value:
22 /* str Match any character not in this
* string. */
#define ANYOF   21 /* str Match any character in this string. */
#define BACK   4 /* Match "", "next" ptr points backward. */
#define BACKPOS_INITIAL   64
#define BACKREF   100
#define BEHIND   11 /* node look behind for a match with operand */
#define BHPOS   19 /* End position for BEHIND or NOBEHIND */
#define BOL   1 /* Match "" at beginning of line. */
#define BOW   15 /* Match "" after [^a-zA-Z0-9_] */
#define BRACE_COMPLEX   140 /* -149 node Match nodes between m & n times */
#define BRACE_LIMITS
Value:
17 /* nr nr define the min & max for BRACE_SIMPLE
* and BRACE_COMPLEX. */
#define BRACE_SIMPLE
Value:
14 /* node Match this (simple) thing between m and
* n times (\{m,n\}). */
#define BRANCH
Value:
3 /* node Match this alternative, or the
* next... */
#define CASEMBC (   x)    case x:
#define CLASS_ALNUM   0
#define CLASS_ALPHA   1
#define CLASS_BACKSPACE   14
#define CLASS_BLANK   2
#define CLASS_CNTRL   3
#define CLASS_DIGIT   4
#define CLASS_ESCAPE   15
#define CLASS_GRAPH   5
#define CLASS_LOWER   6
#define CLASS_NONE   99
#define CLASS_PRINT   7
#define CLASS_PUNCT   8
#define CLASS_RETURN   13
#define CLASS_SPACE   9
#define CLASS_TAB   12
#define CLASS_UPPER   10
#define CLASS_XDIGIT   11
#define CURSOR   203 /* Match location of cursor. */
#define DIGIT   33 /* Match digit char */
#define EMSG2_RET_FAIL (   m,
 
)    return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
#define EMSG2_RET_NULL (   m,
 
)    return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = true, (void *)NULL)
#define EMSG_ONE_RET_NULL
Value:
"E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
#define _(x)
Definition: gettext.h:15
#define MAGIC_ALL
Definition: regexp.c:704
#define EMSG2_RET_NULL(m, c)
Definition: regexp.c:464
#define EMSG_RET_FAIL (   m)    return (EMSG(m), rc_did_emsg = true, FAIL)
#define EMSG_RET_NULL (   m)    return (EMSG(m), rc_did_emsg = true, (void *)NULL)
#define END   0 /* End of program or NOMATCH operand. */
#define EOL   2 /* Match "" at end of line. */
#define EOW   16 /* Match "" at [^a-zA-Z0-9_] */
#define EXACTLY   5 /* str Match this string. */
#define FIRST_NL   ANY + ADD_NL
#define FNAME   27 /* Match file name char */
#define HASLOOKBH   0x10 /* Contains "\@<=" or "\@<!". */
#define HASNL   0x8 /* Contains some \n. */
#define HASWIDTH   0x1 /* Known never to match null string. */
#define HEAD   41 /* Match head char */
#define HEX   35 /* Match hex char */
#define IDENT   23 /* Match identifier char */
#define IEMSG_RET_NULL (   m)    return (IEMSG(m), rc_did_emsg = true, (void *)NULL)
#define is_Magic (   x)    ((x) < 0)
#define JUST_CALC_SIZE   ((char_u *) -1)
#define KWORD   25 /* Match keyword char */
#define LAST_NL   NUPPER + ADD_NL
#define LOWER   45 /* Match lowercase char */
#define Magic (   x)    ((int)(x) - 256)
#define MAGIC_ALL   4 /* "\v" very magic */
#define MAGIC_NONE   1 /* "\V" very unmagic */
#define MAGIC_OFF   2 /* "\M" or 'magic' off */
#define MAGIC_ON   3 /* "\m" or 'magic' */
#define MATCH   9 /* node match the operand zero-width */
#define MAX_LIMIT   (32767L << 16L)
#define MCLOSE   90
#define MOPEN   80
#define MULTI_MULT   2
#define MULTI_ONE   1
#define MULTIBYTECODE   200 /* mbc Match one multi-byte character */
#define NALPHA   44 /* Match non-alpha char */
#define NCLOSE   151 /* Analogous to NOPEN. */
#define NDIGIT   34 /* Match non-digit char */
#define NEWL   18 /* Match line-break */
#define NEXT (   p)    (((*((p) + 1) & 0377) << 8) + (*((p) + 2) & 0377))
#define NHEAD   42 /* Match non-head char */
#define NHEX   36 /* Match non-hex char */
#define NLOWER   46 /* Match non-lowercase char */
#define NOBEHIND   12 /* node look behind for no match with operand */
#define NOCTAL   38 /* Match non-octal char */
#define NOMATCH   10 /* node check for no match with operand */
#define NOPEN
Value:
150 /* Mark this point in input as start of
\%( subexpr. */
#define NOT_MULTI   0
#define NOTHING   6 /* Match empty string. */
#define NUPPER   48 /* Match non-uppercase char */
#define NWHITE   32 /* Match non-whitespace char */
#define NWORD   40 /* Match non-word char */
#define OCTAL   37 /* Match octal char */
#define OP (   p)    ((int)*(p))
#define OPERAND (   p)    ((p) + 3)
#define OPERAND_CMP (   p)    (p)[7]
#define OPERAND_MAX (   p)    OPERAND_MIN((p) + 4)
#define OPERAND_MIN (   p)
Value:
(((long)(p)[3] << 24) + ((long)(p)[4] << 16) \
+ ((long)(p)[5] << 8) + (long)(p)[6])
char_u * p
Definition: eval.c:2042
#define PLUS
Value:
8 /* node Match this (simple) thing 1 or more
* times. */
#define PRINT   29 /* Match printable char */
#define RA_BREAK   3 /* break inner loop */
#define RA_CONT   2 /* continue in inner loop */
#define RA_FAIL   1 /* something failed, abort */
#define RA_MATCH   4 /* successful match */
#define RA_NOMATCH   5 /* didn't match */
#define RE_BOF   201 /* Match "" at beginning of file. */
#define RE_COL   205 /* nr cmp Match column number */
#define RE_COMPOSING   209
#define RE_EOF   202 /* Match "" at end of file. */
#define RE_LNUM   204 /* nr cmp Match line number */
#define RE_MARK   207 /* mark cmp Match mark position */
#define RE_VCOL   206 /* nr cmp Match virtual column number */
#define RE_VISUAL   208 /* Match Visual area */
#define REG_MULTI   (rex.reg_match == NULL)
#define REG_NOPAREN   0 /* toplevel reg() */
#define REG_NPAREN   3 /* \%(\) */
#define REG_PAREN   1 /* \(\) */
#define REG_ZPAREN   2 /* \z(\) */
#define REGMAGIC   0234
#define REGMBC (   x)    regmbc(x);
#define REGSTACK_INITIAL   2048
#define restore_se (   savep,
  posp,
  pp 
)
Value:
{ \
*(posp) = (savep)->se_u.pos; \
*(pp) = (savep)->se_u.ptr; }
if(len)
Definition: encode.c:226
#define REG_MULTI
Definition: regexp.c:3269
else
Definition: eval.c:1854
#define RF_HASNL   4 /* can match a NL */
#define RF_ICASE   1 /* ignore case */
#define RF_ICOMBINE   8 /* ignore combining characters */
#define RF_LOOKBH   16 /* uses "\@<=" or "\@<!" */
#define RF_NOICASE   2 /* don't ignore case */
#define RI_ALPHA   0x20
#define ri_alpha (   c)    (c < 0x100 && (class_tab[c] & RI_ALPHA))
#define RI_DIGIT   0x01
#define ri_digit (   c)    (c < 0x100 && (class_tab[c] & RI_DIGIT))
#define RI_HEAD   0x10
#define ri_head (   c)    (c < 0x100 && (class_tab[c] & RI_HEAD))
#define RI_HEX   0x02
#define ri_hex (   c)    (c < 0x100 && (class_tab[c] & RI_HEX))
#define RI_LOWER   0x40
#define ri_lower (   c)    (c < 0x100 && (class_tab[c] & RI_LOWER))
#define RI_OCTAL   0x04
#define ri_octal (   c)    (c < 0x100 && (class_tab[c] & RI_OCTAL))
#define RI_UPPER   0x80
#define ri_upper (   c)    (c < 0x100 && (class_tab[c] & RI_UPPER))
#define RI_WHITE   0x100
#define ri_white (   c)    (c < 0x100 && (class_tab[c] & RI_WHITE))
#define RI_WORD   0x08
#define ri_word (   c)    (c < 0x100 && (class_tab[c] & RI_WORD))
#define save_se (   savep,
  posp,
  pp 
)    REG_MULTI ? save_se_multi((savep), (posp)) : save_se_one((savep), (pp))
#define SFNAME   28 /* Match file name char but no digit */
#define SIDENT   24 /* Match identifier char but no digit */
#define SIMPLE   0x2 /* Simple enough to be STAR/PLUS operand. */
#define SKWORD   26 /* Match word char but no digit */
#define SPRINT   30 /* Match printable char but no digit */
#define SPSTART   0x4 /* Starts with * or +. */
#define STAR
Value:
7 /* node Match this (simple) thing 0 or more
* times. */
#define SUBPAT   13 /* node match the operand here */
#define UCHARAT (   p)    ((int)*(char_u *)(p))
#define un_Magic (   x)    ((x) + 256)
#define UPPER   47 /* Match uppercase char */
#define WHITE   31 /* Match whitespace char */
#define WITH_NL (   op)    ((op) >= FIRST_NL && (op) <= LAST_NL)
#define WORD   39 /* Match word char */
#define WORST   0 /* Worst case. */
#define ZCLOSE   120
#define ZOPEN   110
#define ZREF   130

Typedef Documentation

typedef struct backpos_S backpos_T
typedef void(*(* fptr_T) (int *, int)
typedef struct regbehind_S regbehind_T
typedef struct regitem_S regitem_T
typedef struct regstar_S regstar_T
typedef enum regstate_E regstate_T

Enumeration Type Documentation

enum regstate_E
Enumerator
RS_NOPEN 
RS_MOPEN 
RS_MCLOSE 
RS_ZOPEN 
RS_ZCLOSE 
RS_BRANCH 
RS_BRCPLX_MORE 
RS_BRCPLX_LONG 
RS_BRCPLX_SHORT 
RS_NOMATCH 
RS_BEHIND1 
RS_BEHIND2 
RS_STAR_LONG 
RS_STAR_SHORT 

Function Documentation

int re_multiline ( regprog_T prog)
reg_extmatch_T* ref_extmatch ( reg_extmatch_T em)
char_u* reg_submatch ( int  no)
list_T* reg_submatch_list ( int  no)
char_u* regtilde ( char_u source,
int  magic 
)
char_u* skip_regexp ( char_u startp,
int  dirc,
int  magic,
char_u **  newp 
)
void unref_extmatch ( reg_extmatch_T em)
regprog_T* vim_regcomp ( char_u expr_arg,
int  re_flags 
)
int vim_regcomp_had_eol ( void  )
int vim_regexec ( regmatch_T rmp,
char_u line,
colnr_T  col 
)
long vim_regexec_multi ( regmmatch_T rmp,
win_T win,
buf_T buf,
linenr_T  lnum,
colnr_T  col,
proftime_T tm 
)

Match a regexp against multiple lines. "rmp->regprog" must be a compiled regexp as returned by vim_regcomp(). Note: "rmp->regprog" may be freed and changed, even set to NULL. Uses curbuf for line count and 'iskeyword'.

Return zero if there is no match. Return number of lines contained in the match otherwise.

int vim_regexec_nl ( regmatch_T rmp,
char_u line,
colnr_T  col 
)
int vim_regexec_prog ( regprog_T **  prog,
bool  ignore_case,
char_u line,
colnr_T  col 
)
void vim_regfree ( regprog_T prog)
int vim_regsub ( regmatch_T rmp,
char_u source,
typval_T expr,
char_u dest,
int  copy,
int  magic,
int  backslash 
)

vim_regsub() - perform substitutions after a vim_regexec() or vim_regexec_multi() match.

If "copy" is TRUE really copy into "dest". If "copy" is FALSE nothing is copied, this is just to find out the length of the result.

If "backslash" is TRUE, a backslash will be removed later, need to double them to keep them, and insert a backslash before a CR to avoid it being replaced with a line break later.

Note: The matched text must not change between the call of vim_regexec()/vim_regexec_multi() and vim_regsub()! It would make the back references invalid!

Returns the size of the replacement, including terminating NUL.

int vim_regsub_multi ( regmmatch_T rmp,
linenr_T  lnum,
char_u source,
char_u dest,
int  copy,
int  magic,
int  backslash 
)

Variable Documentation

parse_state_T