Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_pcre.h
Go to the documentation of this file.
1
9#ifndef __NILOREA_PCRE_HELPERS__
10#define __NILOREA_PCRE_HELPERS__
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#ifdef __sun
17#include <pcre/pcre.h>
18#else
19#include <pcre.h>
20#endif
21
28typedef struct N_PCRE {
32 pcre* regexp;
34 pcre_extra* extra;
35
41 const char** match_list;
44} N_PCRE;
45
46/* pcre helper, compile and optimize regexp */
47N_PCRE* npcre_new(char* str, int max_cap, int flags);
48/* pcre helper, match a regexp against a string */
49int npcre_delete(N_PCRE** pcre);
50/* pcre helper, match a regexp against a string */
51int npcre_clean_match(N_PCRE* pcre);
52/* pcre helper, match a regexp against a string */
53int npcre_match(char* str, N_PCRE* pcre);
54
59#ifdef __cplusplus
60}
61#endif
62/* #ifndef N_STR*/
63#endif
char * regexp_str
original regexp string
Definition n_pcre.h:30
int captured
flag for match_list cleaning
Definition n_pcre.h:43
pcre * regexp
regexp
Definition n_pcre.h:32
const char ** match_list
populated match list if nPcreCapMatch is called
Definition n_pcre.h:41
int * ovector
list of indexes
Definition n_pcre.h:39
int ovecount
configured maximum number of matched occurence
Definition n_pcre.h:37
pcre_extra * extra
optimization if any
Definition n_pcre.h:34
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:150
int npcre_clean_match(N_PCRE *pcre)
clean the match list of the last capture, if any
Definition n_pcre.c:132
int npcre_delete(N_PCRE **pcre)
Free a N_PCRE pointer.
Definition n_pcre.c:102
N_PCRE structure.
Definition n_pcre.h:28