]> git.sur5r.net Git - i3/i3/blob - include/regex.h
Bugfix: Correctly free old assignments when reloading
[i3/i3] / include / regex.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  */
5 #ifndef _REGEX_H
6 #define _REGEX_H
7
8 /**
9  * Creates a new 'regex' struct containing the given pattern and a PCRE
10  * compiled regular expression. Also, calls pcre_study because this regex will
11  * most likely be used often (like for every new window and on every relevant
12  * property change of existing windows).
13  *
14  * Returns NULL if the pattern could not be compiled into a regular expression
15  * (and ELOGs an appropriate error message).
16  *
17  */
18 struct regex *regex_new(const char *pattern);
19
20 /**
21  * Frees the given regular expression. It must not be used afterwards!
22  *
23  */
24 void regex_free(struct regex *regex);
25
26 /**
27  * Checks if the given regular expression matches the given input and returns
28  * true if it does. In either case, it logs the outcome using LOG(), so it will
29  * be visible without any debug loglevel.
30  *
31  */
32 bool regex_matches(struct regex *regex, const char *input);
33
34 #endif