pcre.c
Reports PCRE library version
Synopsis
Prototype
const char* pcre_version (
void
);
Type | Name | Read/Write | Description |
const char* | | RETURN | PCRE 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
(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
);
Type | Name | Read/Write | Description |
const pcre* | external_re | Input | points to compiled code |
int* | optptr | Output | where to pass back the options |
int* | first_byte | Output | where to pass back the first character,
or -1 if multiline and all branches start ^,
or -2 otherwise |
int | | RETURN | number 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
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
);
Type | Name | Read/Write | Description |
const pcre* | external_re | Input | points to compiled code |
const pcre_extra* | extra_data | Input | points extra data, or NULL |
int | what | Input | what information is required |
void* | where | Output | where to put the information |
int | | RETURN | 0 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
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
);
Type | Name | Read/Write | Description |
int | what | Input | what information is required |
void* | where | Output | where to put the information |
int | | RETURN | 0 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
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
);
Type | Name | Read/Write | Description |
const char* | pattern | Input | the regular expression |
int | options | Input | various option bits |
const char** | errorptr | Output | pointer to pointer to error text |
int* | erroroffset | Output | ptr offset in pattern where error was detected |
const unsigned char* | tables | Input | pointer to character tables or NULL |
pcre* | | RETURN | pointer 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
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
);
Type | Name | Read/Write | Description |
const pcre* | external_re | Input | points to the compiled expression |
const pcre_extra* | extra_data | Input | points to extra data or is NULL |
const char* | subject | Input | points to the subject string |
int | length | Input | length of subject string (may contain binary zeros) |
int | start_offset | Input | where to start in the subject string |
int | options | Input | option bits |
int* | offsets | Output | points to a vector of ints to be filled
in with offsets |
int | offsetcount | Input | the 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