GNOME Bugzilla – Bug 456126
Allow extended regular expressions in gnome-search-tool
Last modified: 2007-09-27 04:29:56 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:
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 (®exec_pattern, regex, REG_NOSUB)) { --- > if (!regcomp (®exec_pattern, regex, REG_EXTENDED)) {
*** This bug has been marked as a duplicate of 373398 ***
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.
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 (®exec_pattern, regex, REG_NOSUB)) { + if (!regcomp (®exec_pattern, regex, REG_EXTENDED|REG_NOSUB)) { if (regexec (®exec_pattern, string, 0, 0, 0) != REG_NOMATCH) { return TRUE; }
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.
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
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.