Open jpfleury opened 13 years ago
IMHO the RegExp feature needs much more work before it can be released. The main issue are the different RegExp dialects:
http://www.regular-expressions.info/refflavors.html lists various RE flavors.
I think before the RegExp checkbox can be enabled, the following requirements should be met:
Some possible solutions:
Thoughts? Suggestions?
- grep on Debian and Ubuntu supports PCRE (Perl-compatible syntax) with -P option, which is marked as experimental
- grep on Red Hat (Fedora, RHEL) does not support PCRE (I think they use "POSIX" flavor); a separate pcregrep tool can be installed
So grep -E
(ERE, extended regular expression) should be used to have a common regex flavor between distributions?
- Pythons re module uses an own flavor (this is important for highlighting of results)
If we use grep -E
, then we must have a way to highlight results the same way they're searched. Some ideas:
grep -E
.grep -o
? Then gedit-file-search could highlight fixed strings in results.Some possible solutions:
- use a different grep implementation which is bundled with the plugin; for example ack-grep (http://betterthangrep.com/) is a Perl script (sadly not Python :-) which we might put into the .tgz
Not a bad idea.
- lower the requirements and just use the system grep and let users figure out what dialect is supported on their platform (then the plugin won't behave the same on different platforms; and if we later fix this, people will have to switch to a different RegExp flavor)
It depends on how gedit-file-search is perceived: as an advanced GUI for grep or as an advanced GUI for search.
In the first case, I don't see problems to only use grep capabilities of the current platform.
In the second case, it would be more appropriate to have a single regex syntax for all platforms.
gedit-file-search seems to already have all code needed to search using regular expression. However, we must activate it by hand in gconf-editor (key
/apps/gedit-2/plugins/file-search/is_reg_exp
).It would be convenient to have a checkbox "Regular expression" under the search field, beside "Case sensitive" and "Whole word".