diff options
author | default <nobody@localhost> | 2024-08-23 20:27:07 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2024-08-23 20:27:07 +0200 |
commit | 1370d6b64e984726c096139ab02f4493e6904e2f (patch) | |
tree | 10114b7874469fc96233ddf801d32b6d0bbbfe7d /data.c | |
parent | 8586e44de92c827d6a19a7700121c8b21d3687b1 (diff) |
Searches are now case-insensitive for all alphabets.
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -11,6 +11,7 @@ #include "xs_time.h" #include "xs_regex.h" #include "xs_match.h" +#include "xs_unicode.h" #include "snac.h" @@ -2414,7 +2415,7 @@ xs_list *content_search(snac *user, const char *regex, if (regex == NULL || *regex == '\0') return xs_list_new(); - xs *i_regex = xs_tolower_i(xs_dup(regex)); + xs *i_regex = xs_utf8_to_lower(regex); xs_set seen; @@ -2510,10 +2511,12 @@ xs_list *content_search(snac *user, const char *regex, /* strip HTML */ c = xs_regex_replace_i(c, "<[^>]+>", " "); c = xs_regex_replace_i(c, " {2,}", " "); - c = xs_tolower_i(c); + + /* convert to lowercase */ + xs *lc = xs_utf8_to_lower(c); /* apply regex */ - if (xs_regex_match(c, i_regex)) { + if (xs_regex_match(lc, i_regex)) { if (xs_set_add(&seen, md5) == 1) show--; } |