cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

regex.h
Go to the documentation of this file.
1 /*
2  Copyright 2020 Northern.tech AS
3 
4  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; version 3.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 
19  To the extent this program is licensed as part of the Enterprise
20  versions of CFEngine, the applicable Commercial Open Source License
21  (COSL) may apply to this file if you as a licensee so wish it. See
22  included file COSL.txt.
23 */
24 
25 
26 #ifndef CFENGINE_REGEX_H
27 #define CFENGINE_REGEX_H
28 
29 #include <stdbool.h> // bool
30 #include <pcre.h>
31 
32 #include <sequence.h> /* Seq */
33 
34 #define CFENGINE_REGEX_WHITESPACE_IN_CONTEXTS ".*[_A-Za-z0-9][ \\t]+[_A-Za-z0-9].*"
35 
36 /* Try to use CompileRegex() and StringMatchWithPrecompiledRegex(). */
37 pcre *CompileRegex(const char *regex);
38 bool StringMatch(const char *regex, const char *str, int *start, int *end);
39 bool StringMatchWithPrecompiledRegex(pcre *regex, const char *str,
40  int *start, int *end);
41 bool StringMatchFull(const char *regex, const char *str);
42 bool StringMatchFullWithPrecompiledRegex(pcre *regex, const char *str);
43 Seq *StringMatchCaptures(const char *regex, const char *str, const bool return_names);
44 Seq *StringMatchCapturesWithPrecompiledRegex(const pcre *pattern, const char *str, const bool return_names);
45 bool CompareStringOrRegex(const char *value, const char *compareTo, bool regex);
46 
47 /* Does not free rx! */
48 bool RegexPartialMatch(const pcre *rx, const char *teststring);
49 
50 #endif /* CFENGINE_REGEX_H */
Seq * StringMatchCapturesWithPrecompiledRegex(const pcre *pattern, const char *str, const bool return_names)
Definition: regex.c:144
pcre * CompileRegex(const char *regex)
Definition: regex.c:37
bool StringMatchFull(const char *regex, const char *str)
Definition: regex.c:106
bool StringMatch(const char *regex, const char *str, int *start, int *end)
Definition: regex.c:90
bool StringMatchWithPrecompiledRegex(pcre *regex, const char *str, int *start, int *end)
Definition: regex.c:55
bool StringMatchFullWithPrecompiledRegex(pcre *regex, const char *str)
Definition: regex.c:121
bool RegexPartialMatch(const pcre *rx, const char *teststring)
Definition: regex.c:278
Seq * StringMatchCaptures(const char *regex, const char *str, const bool return_names)
Definition: regex.c:232
bool CompareStringOrRegex(const char *value, const char *compareTo, bool regex)
Definition: regex.c:255
Sequence data-structure.
Definition: sequence.h:50