pcre.c


Function pcre_version

Reports PCRE library version

Synopsis

Prototype
const char* pcre_version (
      void
);

TypeNameRead/WriteDescription
const char* RETURNPCRE library version

Returns
const char*:PCRE library version

Description

Reports PCRE library version

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_info

(Obsolete) Return info about compiled pattern

This is the original "info" function. It picks potentially useful data out of the private structure, but its interface was too rigid. It remains for backwards compatibility. The public options are passed back in an int - though the re->options field has been expanded to a long int, all the public options at the low end of it, and so even on 16-bit systems this will still be OK. Therefore, I haven't changed the API for pcre_info().

Synopsis

Prototype
int pcre_info (
      const pcre* external_re,
      int* optptr,
      int* first_byte
);

TypeNameRead/WriteDescription
const pcre*external_reInputpoints to compiled code
int*optptrOutputwhere to pass back the options
int*first_byteOutputwhere to pass back the first character, or -1 if multiline and all branches start ^, or -2 otherwise
int RETURNnumber of capturing subpatterns or negative values on error

Input
external_re:(Input)points to compiled code
Output
optptr:(Output)where to pass back the options
first_byte:(Output)where to pass back the first character, or -1 if multiline and all branches start ^, or -2 otherwise
Returns
int:number of capturing subpatterns or negative values on error

Description

(Obsolete) Return info about compiled pattern

This is the original "info" function. It picks potentially useful data out of the private structure, but its interface was too rigid. It remains for backwards compatibility. The public options are passed back in an int - though the re->options field has been expanded to a long int, all the public options at the low end of it, and so even on 16-bit systems this will still be OK. Therefore, I haven't changed the API for pcre_info().

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_fullinfo

Return info about compiled pattern

This is a newer "info" function which has an extensible interface so that additional items can be added compatibly.

Synopsis

Prototype
int pcre_fullinfo (
      const pcre* external_re,
      const pcre_extra* extra_data,
      int what,
      void* where
);

TypeNameRead/WriteDescription
const pcre*external_reInputpoints to compiled code
const pcre_extra*extra_dataInputpoints extra data, or NULL
intwhatInputwhat information is required
void*whereOutputwhere to put the information
int RETURN0 if data returned, negative on error

Input
external_re:(Input)points to compiled code
extra_data:(Input)points extra data, or NULL
what:(Input)what information is required
Output
where:(Output)where to put the information
Returns
int:0 if data returned, negative on error

Description

Return info about compiled pattern

This is a newer "info" function which has an extensible interface so that additional items can be added compatibly.

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_config

Return info about what features are configured

This is function which has an extensible interface so that additional items can be added compatibly.

Synopsis

Prototype
int pcre_config (
      int what,
      void* where
);

TypeNameRead/WriteDescription
intwhatInputwhat information is required
void*whereOutputwhere to put the information
int RETURN0 if data returned, negative on error

Input
what:(Input)what information is required
Output
where:(Output)where to put the information
Returns
int:0 if data returned, negative on error

Description

Return info about what features are configured

This is function which has an extensible interface so that additional items can be added compatibly.

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_compile

Compile a Regular Expression

This function takes a string and returns a pointer to a block of store holding a compiled version of the expression.

Synopsis

Prototype
pcre* pcre_compile (
      const char* pattern,
      int options,
      const char** errorptr,
      int* erroroffset,
      const unsigned char* tables
);

TypeNameRead/WriteDescription
const char*patternInputthe regular expression
intoptionsInputvarious option bits
const char**errorptrOutputpointer to pointer to error text
int*erroroffsetOutputptr offset in pattern where error was detected
const unsigned char*tablesInputpointer to character tables or NULL
pcre* RETURNpointer to compiled data block, or NULL on error, with errorptr and erroroffset set

Input
pattern:(Input)the regular expression
options:(Input)various option bits
tables:(Input)pointer to character tables or NULL
Output
errorptr:(Output)pointer to pointer to error text
erroroffset:(Output)ptr offset in pattern where error was detected
Returns
pcre*:pointer to compiled data block, or NULL on error, with errorptr and erroroffset set

Description

Compile a Regular Expression

This function takes a string and returns a pointer to a block of store holding a compiled version of the 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_exec

Execute a Regular Expression

This function applies a compiled re to a subject string and picks out portions of the string if it matches. Two elements in the vector are set for each substring: the offsets to the start and end of the substring.

Synopsis

Prototype
int pcre_exec (
      const pcre* external_re,
      const pcre_extra* extra_data,
      const char* subject,
      int length,
      int start_offset,
      int options,
      int* offsets,
      int offsetcount
);

TypeNameRead/WriteDescription
const pcre*external_reInputpoints to the compiled expression
const pcre_extra*extra_dataInputpoints to extra data or is NULL
const char*subjectInputpoints to the subject string
intlengthInputlength of subject string (may contain binary zeros)
intstart_offsetInputwhere to start in the subject string
intoptionsInputoption bits
int*offsetsOutputpoints to a vector of ints to be filled in with offsets
intoffsetcountInputthe number of elements in the vector
int RETURN> 0 => success; value is the number of elements filled in = 0 => success, but offsets is not big enough -1 => failed to match < -1 => some kind of unexpected problem

Input
external_re:(Input)points to the compiled expression
extra_data:(Input)points to extra data or is NULL
subject:(Input)points to the subject string
length:(Input)length of subject string (may contain binary zeros)
start_offset:(Input)where to start in the subject string
options:(Input)option bits
offsetcount:(Input)the number of elements in the vector
Output
offsets:(Output)points to a vector of ints to be filled in with offsets
Returns
int:> 0 => success; value is the number of elements filled in = 0 => success, but offsets is not big enough -1 => failed to match < -1 => some kind of unexpected problem

Description

Execute a Regular Expression

This function applies a compiled re to a subject string and picks out portions of the string if it matches. Two elements in the vector are set for each substring: the offsets to the start and end of the substring.

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