Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
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#endif
14
15#ifdef __sun
16#include <pcre/pcre.h>
17#else
18#include <pcre.h>
19#endif
20
27typedef struct N_PCRE {
31 pcre* regexp;
33 pcre_extra* extra;
34
40 const char** match_list;
43} N_PCRE;
44
45/* pcre helper, compile and optimize regexp */
46N_PCRE* npcre_new(char* str, int max_cap, int flags);
47/* pcre helper, match a regexp against a string */
48int npcre_delete(N_PCRE** pcre);
49/* pcre helper, match a regexp against a string */
50int npcre_clean_match(N_PCRE* pcre);
51/* pcre helper, match a regexp against a string */
52int npcre_match(char* str, N_PCRE* pcre);
53
58#ifdef __cplusplus
59}
60#endif
61/* #ifndef N_STR*/
62#endif
char * regexp_str
original regexp string
Definition n_pcre.h:29
int captured
flag for match_list cleaning
Definition n_pcre.h:42
pcre * regexp
regexp
Definition n_pcre.h:31
const char ** match_list
populated match list if nPcreCapMatch is called
Definition n_pcre.h:40
int * ovector
list of indexes
Definition n_pcre.h:38
int ovecount
configured maximum number of matched occurence
Definition n_pcre.h:36
pcre_extra * extra
optimization if any
Definition n_pcre.h:33
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:58
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:149
int npcre_clean_match(N_PCRE *pcre)
clean the match list of the last capture, if any
Definition n_pcre.c:131
int npcre_delete(N_PCRE **pcre)
Free a N_PCRE pointer.
Definition n_pcre.c:101
N_PCRE structure.
Definition n_pcre.h:27