forked from mohangk/playing_with_regex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_text_matcher.c
41 lines (30 loc) · 1.04 KB
/
test_text_matcher.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#define PCRE2_STATIC
#define PCRE2_CODE_UNIT_WIDTH 8
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "preg_replace.h"
#include <assert.h>
int main(int argc, char **argv)
{
char *testQuery[11];
testQuery[0] = "test abc,def test";
testQuery[1] = "test L'oreal `` \"test\" ' *hoho*";
testQuery[2] = "test (test1) (test2) ()";
testQuery[3] = "test abc, def, ghi";
testQuery[4] = "test.(abc @def #g (h [i {j 'k `l";
testQuery[5] = "test a) b] c} d! e? f. g' h: i; j% k` test) a";
testQuery[6] = "http://www.google.co.id/search";
testQuery[7] = "test test123 abc & def";
testQuery[8] = "test 123\n234 b\r";
testQuery[9] = "test [link text](1234567 \"link title\") abc [link text](1234567 \"\")";
testQuery[10] = "‘Tembok China’";
char **matches = NULL;
int count = preg_match("(\\w+) (\\w+)", testQuery[0], matches);
printf("%d matches!", count);
/* for (int i = 0; i < count; i++) */
/* { */
/* printf("%s",matches[i]); */
/* } */
return 0;
}