Nilorea Library
C utilities for networking, threading, graphics
n_pcre.h
Go to the documentation of this file.
1
8#ifndef __NILOREA_PCRE_HELPERS__
9#define __NILOREA_PCRE_HELPERS__
10
11#ifdef __cplusplus
12extern "C"
13{
14#endif
15
16#ifdef __sun
17#include <pcre/pcre.h>
18#else
19#include <pcre.h>
20#endif
21
28typedef struct N_PCRE
29{
31 char *regexp_str ;
33 pcre *regexp;
35 pcre_extra *extra;
36
42 const char** match_list;
45} N_PCRE ;
46
47
48
49/* pcre helper, compile and optimize regexp */
50N_PCRE *npcre_new( char *str, int max_cap, int flags );
51/* pcre helper, match a regexp against a string */
52int npcre_delete( N_PCRE ** pcre );
53/* pcre helper, match a regexp against a string */
54int npcre_clean_match( N_PCRE * pcre );
55/* pcre helper, match a regexp against a string */
56int npcre_match( char *str, N_PCRE *pcre );
57
62#ifdef __cplusplus
63}
64#endif
65/* #ifndef N_STR*/
66#endif
char * regexp_str
original regexp string
Definition: n_pcre.h:31
int captured
flag for match_list cleaning
Definition: n_pcre.h:44
pcre * regexp
regexp
Definition: n_pcre.h:33
const char ** match_list
populated match list if nPcreCapMatch is called
Definition: n_pcre.h:42
int * ovector
list of indexes
Definition: n_pcre.h:40
int ovecount
configured maximum number of matched occurence
Definition: n_pcre.h:38
pcre_extra * extra
optimization if any
Definition: n_pcre.h:35
N_PCRE * npcre_new(char *str, int max_cap, int flags)
From pcre doc, the flag bits are: PCRE_ANCHORED Force pattern anchoring PCRE_AUTO_CALLOUT Compile aut...
Definition: n_pcre.c:59
int npcre_match(char *str, N_PCRE *pcre)
Return TRUE if str matches regexp, and make captures up to max_cap.
Definition: n_pcre.c:165
int npcre_clean_match(N_PCRE *pcre)
clean the match list of the last capture, if any
Definition: n_pcre.c:144
int npcre_delete(N_PCRE **pcre)
Free a N_PCRE pointer.
Definition: n_pcre.c:107
N_PCRE structure.
Definition: n_pcre.h:29