15 |
|
|
16 |
|
Matcher::~Matcher() |
17 |
|
{ |
18 |
< |
if (this->expression != NULL) |
18 |
> |
if (expression != NULL) |
19 |
|
{ |
20 |
< |
pcre_free(this->expression); |
20 |
> |
pcre_free(expression); |
21 |
|
} |
22 |
|
} |
23 |
|
|
24 |
|
bool Matcher::match(const string& stuff) |
25 |
|
{ |
26 |
|
substrings.clear(); |
27 |
< |
|
28 |
< |
if (this->expression != NULL) |
27 |
> |
|
28 |
> |
if (expression != NULL) |
29 |
|
{ |
30 |
|
int length; |
31 |
|
|
34 |
|
int* substrings = new int[(++length *= 3)]; |
35 |
|
int count = pcre_exec(expression, NULL, stuff.c_str(), stuff.length(), |
36 |
|
0, 0, substrings, length); |
37 |
< |
|
37 |
> |
|
38 |
|
if (count > 0) |
39 |
|
{ |
40 |
|
char* substring = new char[stuff.length() + 1]; |
61 |
|
Matcher& Matcher::operator()(const string& expression) |
62 |
|
{ |
63 |
|
substrings.clear(); |
64 |
< |
|
64 |
> |
|
65 |
|
if (this->expression != NULL) |
66 |
|
{ |
67 |
|
pcre_free(this->expression); |