Implement support for PCRE regular expressions for all criteria (for_window, commands, assignments)

This commit is contained in:
Michael Stapelberg
2011-09-10 23:53:11 +01:00
parent 8e04867e51
commit 2fc54aadf1
8 changed files with 157 additions and 35 deletions

28
include/regex.h Normal file
View File

@ -0,0 +1,28 @@
/*
* vim:ts=4:sw=4:expandtab
*
*/
#ifndef _REGEX_H
#define _REGEX_H
/**
* Creates a new 'regex' struct containing the given pattern and a PCRE
* compiled regular expression. Also, calls pcre_study because this regex will
* most likely be used often (like for every new window and on every relevant
* property change of existing windows).
*
* Returns NULL if the pattern could not be compiled into a regular expression
* (and ELOGs an appropriate error message).
*
*/
struct regex *regex_new(const char *pattern);
/**
* Checks if the given regular expression matches the given input and returns
* true if it does. In either case, it logs the outcome using LOG(), so it will
* be visible without any debug loglevel.
*
*/
bool regex_matches(struct regex *regex, const char *input);
#endif