After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 456126 - Allow extended regular expressions in gnome-search-tool
Allow extended regular expressions in gnome-search-tool
Status: RESOLVED FIXED
Product: gnome-utils
Classification: Deprecated
Component: gsearchtool
2.18.x
Other All
: Normal enhancement
: ---
Assigned To: gnome-utils Maintainers
gnome-utils Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-07-12 04:17 UTC by Kevin Cassidy
Modified: 2007-09-27 04:29 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Kevin Cassidy 2007-07-12 04:17:33 UTC
The default expression type for regexec() is basic. Passing the cflag REG_EXTENDED will allow modern regular expressions with special characters, for example: "this_pattern_or|that_pattern". See 'man re_format'.

Other information:
Comment 1 Kevin Cassidy 2007-07-12 04:33:39 UTC
This change seems to work, although I'm not a programmer and it's possible that something else may be broken:


gsearchtool-support.c
490c490
<       if (!regcomp (&regexec_pattern, regex, REG_NOSUB)) {
---
>       if (!regcomp (&regexec_pattern, regex, REG_EXTENDED)) {
Comment 2 Kevin Cassidy 2007-07-12 04:38:38 UTC

*** This bug has been marked as a duplicate of 373398 ***
Comment 3 Kevin Cassidy 2007-07-12 04:51:27 UTC
This is not a duplicate of bug 373398. I'm speaking of the "Name matches regular expression" filter, not matching file contents with regular expressions.
Comment 4 Dennis Cranston 2007-07-26 05:58:21 UTC
I believe the proper change would be as follows.  Can you that you still get the results you are expecting?  Thanks.

Index: gsearchtool-support.c
===================================================================
--- gsearchtool-support.c       (revision 7531)
+++ gsearchtool-support.c       (working copy)
@@ -488,7 +488,7 @@
                return TRUE;
        }
 
-       if (!regcomp (&regexec_pattern, regex, REG_NOSUB)) {
+       if (!regcomp (&regexec_pattern, regex, REG_EXTENDED|REG_NOSUB)) {
                if (regexec (&regexec_pattern, string, 0, 0, 0) != REG_NOMATCH) {
                        return TRUE;
                }
Comment 5 Dennis Cranston 2007-07-26 06:04:41 UTC
I should have asked...  Can you please verify the results are what you expect using the code in comment #4?  Thanks & sorry for any confusion.
Comment 6 Kevin Cassidy 2007-07-26 10:39:04 UTC
Yes, that works perfectly. A simple test is to try an "or" search in the regexp field. This functionality isn't present without your patch.

file1|file2
Comment 7 Dennis Cranston 2007-09-27 04:29:56 UTC
Patch applied to SVN (HEAD).  Thanks.

2007-09-26  Dennis Cranston  <dennis_cranston@yahoo.com>

	* gsearchtool-support.c: (compare_regex): Fix bug #456126, allow
	extended regular expressions.