GNOME Bugzilla – Bug 369269
add support for regexp search
Last modified: 2008-08-03 00:11:04 UTC
I've written a small patch to add regexp search support to GtkSourceView. I'll attach it to this bug report. It doesn't support multiline regexp search, but I don't think any text editor supports that. It supports case-sensitive and case-insensitive regexp search, using the existing case_sensitive flag of the search.
Created attachment 75819 [details] [review] the patch I suggest. let me know if it's not good for some reason, I can update it if needed.
Er, sorry the: if (search_regex == NULL) printf ("WARNING, invalid regex...\n"); is not good at all. Will update the code to return "no match" in the case of an invalid regexp. will update the patch soon. I just forgot about it :-/
Created attachment 75852 [details] [review] updated patch this patch reacts better to invalid regexps: simply say that we didn't find any matches.
(In reply to comment #0) > [..] It doesn't support multiline regexp search, but I don't > think any text editor supports that. [..] EmEditor [1] for example does support multi-line regex for search and replace. It's proprietary and for Windows though. [1] http://www.emeditor.com/
Ping maintainers on this! There is no real reply on if the patch is good or not and I think it would be really nice to have regex support in GtkSourceView.
I am really sorry we have dropped the ball on this one... regex search is *definitely* something we want in gtksourceview, but between an engine rewrite in the last devel cycle and real life in the current one, this patch never even got near to the top of the priority list :-( Help is very very very welcome. Another thing that happened in the mean time is that glib has gained a regex library (gregex) that we are happily using in the syntax engine, so gregex is an obvious implementation choice here.
yes, i also think the patch attachment should be marked obsolete because of that regex engine, but i didn't find how to do it without attaching another patch. i change the name of the bug, though, since the patch is obsolete.
*** This bug has been marked as a duplicate of 134674 ***