Defines | Typedefs | Functions
rexregex.h File Reference

Definition of RegEx interface. More...

Go to the source code of this file.

Defines

#define REX_ENCODING_UTF8   0
#define REX_ENCODING_BYTE   1

Typedefs

typedef struct rexregex_s rexregex_t

Functions

rexregex_trex_regex_create (const char *str, unsigned int size)
rexregex_trex_regex_create_s (const char *str)
int rex_regex_match (rexregex_t *regex, unsigned int encoding, const char *start, const char *end)
int rex_regex_scan (rexregex_t *regex, unsigned int encoding, const char *start, const char *end, const char **where)
void rex_regex_destroy (rexregex_t *regex)

Detailed Description

Definition of RegEx interface.

Synopsis

This file defines the data structures and API for the RegEx implementation.


Define Documentation

#define REX_ENCODING_BYTE   1

The encoding is one byte per character

#define REX_ENCODING_UTF8   0

Input is encoded in UTF8.


Typedef Documentation

typedef struct rexregex_s rexregex_t

Define RegEx object


Function Documentation

rexregex_t* rex_regex_create ( const char *  str,
unsigned int  size 
)

Create regular expression object.

Parameters:
strRegular Expression
sizeThe size of str in bytes.
Returns:
Regular Expression object.
rexregex_t* rex_regex_create_s ( const char *  str)

Create regular expression object.

Parameters:
strRegular Expression. The string must be NULL terminated
Returns:
Regular Expression object.
void rex_regex_destroy ( rexregex_t regex)

Destroy regex object created with rex_regex_create or rex_regex_create_s

Parameters:
regexregular expression object to be destroyed.
int rex_regex_match ( rexregex_t regex,
unsigned int  encoding,
const char *  start,
const char *  end 
)

Match regular expression.

Parameters:
regexregular expression object created with rex_regex_create or rex_regex_create_s
encodingInput encoding. Supported encodings:
startInput start pointer
endInput end pointer
Returns:
Returns the size in bytes of the matched substring or 0 if no match, -1 in case of error.
int rex_regex_scan ( rexregex_t regex,
unsigned int  encoding,
const char *  start,
const char *  end,
const char **  where 
)

Search for regular expression match within the input specified with start and end.

Parameters:
regexregular expression object created with rex_regex_create or rex_regex_create_s
encodingInput encoding. Supported encodings:
startInput start pointer
endInput end pointer
whereIt would be set to the beginning of the matched substring.
Returns:
Returns the size in bytes of the matched substring or 0 if no match, -1 in case of error. If 'where' is not NULL, it would be set to the beginning of the matched substring.