aboutsummaryrefslogtreecommitdiffstats
path: root/src/match.c
diff options
context:
space:
mode:
authorFredrik Lanker <fredrik.lanker@gmail.com>2009-01-03 12:15:28 +0100
committerMax Kellermann <max@duempel.org>2009-01-03 12:15:28 +0100
commit9416a2a96bc45e98387297dc3d3846285d380c4f (patch)
treec8011411a70fe91240a9f464fbaf26d20514549a /src/match.c
parent0c479e3802a334c02d427445679dabcc8031fa18 (diff)
downloadmpd-9416a2a96bc45e98387297dc3d3846285d380c4f.tar.gz
mpd-9416a2a96bc45e98387297dc3d3846285d380c4f.tar.xz
mpd-9416a2a96bc45e98387297dc3d3846285d380c4f.zip
match: enable regular expressions when using find
It uses g_regex_match_simple() in glib and is case insensitive. The search in the NCMPC_MINI case is unchanged.
Diffstat (limited to '')
-rw-r--r--src/match.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/match.c b/src/match.c
index 0bd8b3644..c97cde510 100644
--- a/src/match.c
+++ b/src/match.c
@@ -39,7 +39,10 @@ match_line(const char *line, const char *needle)
char *line_folded = locale_casefold(line);
char *needle_folded = locale_casefold(needle);
- bool ret = strstr(line_folded, needle_folded) != NULL;
+ bool ret = (bool)g_regex_match_simple((const gchar*)needle_folded,
+ (const gchar*)line_folded,
+ G_REGEX_CASELESS | G_REGEX_DOTALL | G_REGEX_OPTIMIZE,
+ 0);
g_free(line_folded);
g_free(needle_folded);