new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / os_regex / os_pcre2.c
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All right reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 2) as published by the FSF - Free Software
7  * Foundation
8  */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13
14 #include "os_regex.h"
15
16 int OS_Pcre2(const char *pattern, const char *str)
17 {
18     int r_code = 0;
19     OSPcre2 reg;
20
21     if (OSPcre2_Compile(pattern, &reg, PCRE2_UTF | PCRE2_NO_UTF_CHECK | PCRE2_CASELESS)) {
22         if(OSPcre2_Execute(str, &reg)) {
23             r_code = 1;
24         }
25
26         OSPcre2_FreePattern(&reg);
27     }
28
29     return (r_code);
30 }
31