Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
regmatch.cc
Go to the documentation of this file.
1
7#include "regmatch.h"
8#include <string>
9
10#include <sys/types.h>
11#include <regex.h>
12#include <stdio.h>
13
14using namespace ::std;
15
16//------------------------------------------------------------------------
17int Binc::regexMatch(const string &data_in, const string &p_in)
18{
19 regex_t r;
20 regmatch_t rm[2];
21
22 if (regcomp(&r, p_in.c_str(), REG_EXTENDED | REG_NOSUB) != 0)
23 return 2;
24
25 int n = regexec(&r, data_in.c_str(), data_in.length(), rm, 0);
26 regfree(&r);
27 if (n == 0)
28 return 0;
29 else
30 return 2;
31}
int regexMatch(const std::string &data_in, const std::string &p_in)