> On Nov 7, 2022, at 3:52 AM, Eli Zaretskii <eliz@gnu.org> wrote: > >> From: Yuan Fu <casouri@gmail.com> >> Date: Sun, 6 Nov 2022 21:41:42 -0800 >> >> Is there a function that matches regex case-sensitively in a C string? Ie, >> something like fast_c_string_match_ignore_case but case-sensitive. > > I don't think so, but it should be trivial to add such a function if > you need it. Cool, I need some help understanding fast_c_string_match_ignore_case: ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string, ptrdiff_t len) { regexp = string_make_unibyte (regexp); // Why do we need to unwind stack? specpdl_ref count = SPECPDL_INDEX (); struct regexp_cache *cache_entry = compile_pattern (regexp, 0, Vascii_canon_table, 0, 0); // What does freezing a pattern do? freeze_pattern (cache_entry); // What is re_match_object for? I see that it can be t, nil or a string. re_match_object = Qt; // ptrdiff_t val = re_search (&cache_entry->buf, string, len, 0, len, 0); unbind_to (count, Qnil); return val; } Yuan
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4