pcreposix.c


Function pcre_regerror

Translate error code to string

Synopsis

Prototype
size_t pcre_regerror (
      int errcode,
      const regex_t* preg,
      char* errbuf,
      size_t errbuf_size
);

TypeNameRead/WriteDescription
interrcodeInputError code
const regex_t*pregInputCompiled expresion
char*errbufOutputerror buffer
size_terrbuf_sizeInputerror buffer size
size_t RETURNMessage length

Input
errcode:(Input)Error code
preg:(Input)Compiled expresion
errbuf_size:(Input)error buffer size
Output
errbuf:(Output)error buffer
Returns
size_t:Message length

Description

Translate error code to string

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 5.0.0

Function pcre_regfree

Free store held by a regex

Synopsis

Prototype
void pcre_regfree (
      regex_t* preg
);

TypeNameRead/WriteDescription
regex_t*pregDeleteRegex
void RETURN

Output
preg:(Delete)Regex
Returns
void:No return value

Description

Free store held by a regex

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 5.0.0

Function pcre_regcomp

Compile a regular expression

Synopsis

Prototype
int pcre_regcomp (
      regex_t* preg,
      const char* pattern,
      int cflags
);

TypeNameRead/WriteDescription
regex_t*pregOutputpoints to a structure for recording the compiled expression
const char*patternInputthe pattern to compile
intcflagsInputcompilation flags
int RETURN0 on success various non-zero codes on failure

Input
pattern:(Input)the pattern to compile
cflags:(Input)compilation flags
Output
preg:(Output)points to a structure for recording the compiled expression
Returns
int:0 on success various non-zero codes on failure

Description

Compile a regular expression

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 5.0.0

Function pcre_regexec

Match a regular expression

Unfortunately, PCRE requires 3 ints of working space for each captured substring, so we have to get and release working store instead of just using the POSIX structures as was done in earlier releases when PCRE needed only 2 ints. However, if the number of possible capturing brackets is small, use a block of store on the stack, to reduce the use of malloc/free. The threshold is in a macro that can be changed at configure time.

Synopsis

Prototype
int pcre_regexec (
      const regex_t* preg,
      const char* strng,
      size_t nmatch,
      regmatch_t[] pmatch,
      int eflags
);

TypeNameRead/WriteDescription
const regex_t*pregInputUndocumented
const char*strngInputUndocumented
size_tnmatchInputUndocumented
regmatch_t[]pmatchModifyUndocumented
inteflagsInputUndocumented
int RETURNUndocumented

Input
preg:(Input)Undocumented
strng:(Input)Undocumented
nmatch:(Input)Undocumented
eflags:(Input)Undocumented
Input & Output
pmatch:(Modify)Undocumented
Returns
int:Undocumented

Description

Match a regular expression

Unfortunately, PCRE requires 3 ints of working space for each captured substring, so we have to get and release working store instead of just using the POSIX structures as was done in earlier releases when PCRE needed only 2 ints. However, if the number of possible capturing brackets is small, use a block of store on the stack, to reduce the use of malloc/free. The threshold is in a macro that can be changed at configure time.

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 5.0.0