29 May, 2006

Regex searches in gedit!

One thing that bothered me about gedit was the lack of support for regular expressions when searching text. But now that gedit have Python plugins I thought that it would be really easy to add such thing using Python's "re" module.

And indeed it was. Now I have this neat Python plugin called "Regex Search". You can download it from here.

Here is a screenshot of the plugin in action:


Just put the files in /usr/[local/]lib/gedit-2/plugins, as it's not a package yet. You can then access it from the "Tools" menu, in gedit.

I hope gedit guys will realize the imense usefulness of this plugin an decide to ship it along with the standard plugins. :-D

Update: Forgot to say that you need at least a gedit 2.14 to run this, since Python plugins are a relatively new addition.

14 Comments:

Blogger Bobby Jack said...

This is a great extension, but I echo the sentiments of "groening": replace is a core requirement for developers using gedit. Obviously, that's quite a bigger task than the standard search, but I see no reason for the community not to be working on this.

Is there somewhere more permanent than a blog that development on this plugin can be tracked?

It would also be nice for regexp search to be line-based - i.e. ^ and $ should refer to the beginning/end of each line, not the entire document.

I'm considering doing some work on this - do you intend to accept patches and/or maintain this plugin for future development?

February 13, 2007 at 5:00 PM  
Blogger dakomoon said...

Man your a life saver thanks a million.

June 8, 2007 at 8:37 PM  
Blogger Rafael said...

Hey man! Here is your plugin with replace stuff

http://rafaelsilva.net/node/103

Thankyou!

October 25, 2007 at 1:35 PM  
Blogger Unknown said...

@rafael

That's nice Rafael. It's good to see the code being extended and improved.

It seens Ben Fisher also took it one step further.

March 31, 2008 at 8:14 AM  
Blogger Rafael said...

Hey, very good to know :-)

May 21, 2008 at 10:11 PM  
Blogger Unknown said...

COULD IT BE MORE STABLE... Was workin very well and then not able to replace anything anymore. At least it was still finding the stuff...

Like plugin that work each time you need it not only when the want

February 13, 2009 at 1:21 PM  
Blogger Unknown said...

@cesium5500, Groening, bobby

Hi there. I'm glad to know that it was useful to you somehow.

I made this plugin a long time ago, delivered it to gedit guys but it was not integrated into their main tree, thus it has not been maintained since.

It's also a basic regex thing and definitely lacking features. Some people extended it further, as you can see in previous comments, but it seems it still didn't make it into the main tree.

Anyway, I'm a bit surprised that it's still compatible with the current gedit API.

February 14, 2009 at 1:53 PM  
Anonymous Anonymous said...

Hi, Daniel!

I found your plugin and the link to the Rafael Silva's version in this blog. It helped me a lot!

OTOH, I missed some functionalities in it, so I added it. For easing access and contribution, I created a project at bitbucket to share this version: http://bitbucket.org/brandizzi/gedit-re-search/

I think you would like to know it.

Thank you, again!

January 13, 2010 at 9:21 PM  
Blogger Unknown said...

@brandizzi

Good to know indeed.

January 19, 2010 at 2:31 PM  
Blogger Unknown said...

THANK YOU!!!!!

February 17, 2011 at 12:02 AM  
Blogger Yasir Elsharif said...

The best regular expression plugin is "advanced-find" available from http://code.google.com/p/advanced-find/ check it out and I am sure you'll be satisfied. Yasir

October 19, 2011 at 6:16 AM  
Blogger ybr (alias ybrao a donkey) said...

I use gedit regex window everyday. I am able to use backreferencing with \1, \2 etc. for replace. I am unable to trace out a replacement backreference for lower case conversion. In Vim it works wtth 0_lowerCase(). I tried things like \1,l, \1L, \1:l. Literal replacements occur. Could you pl. email your advice to ybhask@gmail.com? Thanks in advance.

December 6, 2011 at 12:07 PM  
Blogger Wendell said...

Do you have any good resources for dealing with the doc object in a gedit python plugin?

I want to perform some document validation logic to it and display an error dialog if its misformed.

thx.
W. MacKenzie

December 2, 2012 at 11:16 PM  
Blogger Unknown said...

@Wendell

No, I don't. It's been a long time since I last played with gedit code.

December 3, 2012 at 12:18 PM  

Post a Comment

<< Home