From 9416a2a96bc45e98387297dc3d3846285d380c4f Mon Sep 17 00:00:00 2001 From: Fredrik Lanker Date: Sat, 3 Jan 2009 12:15:28 +0100 Subject: [PATCH] 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. --- NEWS | 1 + src/match.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 92b426e..398df80 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ ncmpc 0.13 - not yet released * new --disable-multibyte configure option; this allows you to disable wide character support, retaining multibyte character support + * search with regular expressions ncmpc 0.12 - 2008-12-05 diff --git a/src/match.c b/src/match.c index 0bd8b36..c97cde5 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); -- 2.30.2