Thanks a lot for the excellent plugin. However it would be even better if it didn't disable the replace buttons if there's no text in the replace field. Sometimes we need to just remove some parts of a text, not replace them with something else. Can you do this?
Thanks for this, but my first use of it found a bug. I want to remove the first two leading spaces, so I search for '^ '
It looks like the '^' is not bound to the start of the current line, it's bound to the point where the search begins. Being cautious, I used 'find' a few times before doing the replace all. It steps through multiple matches on the same line.
My wishlist:
1. Fix the above 2. Add a hotkey to bring up the dialog 3. Add a replace and search again button with keyboard shortcut.
It's nearly there.
I've been using nedit, which is not bad, except that it doesn't understand the gnome virtual file system, which would be much more convenient sometimes.
Small bug though: when there is 2 successive matches the second one isn't caught. Example: when using "<.+?>" on "this is a test test" the < /b> isn't caught.
For those who want to replace something for nothing (the empty string), if we open the file regexsearchinstance.py and change the line ---- if len(search_text) > 0 and len(replace_text) > 0: ---- to ---- if len(search_text) > 0:# and len(replace_text) > 0: ---- and save, the program will not disable the replace all button. (but I'm not sure if it will break it in anyway - I hope not).
Gavin, I too find that annoying, but you can use a trick to workaround that: just enclose the \n in the search field as (\n), and use \1 (or whatever numbered reference it is) in the replace field.
Granted, this is not a complete solution, since not always you'll have newlines in the search field, but as I said, it's a workaround :)
Btw, thanks anonymous (↑↑) for the empty string replace trick! However, I think I don't recall doing it, and nevertheless the replace button doesn't get deactivated when the replace field is empty (I can't remember when it stopped doing that). Can anyone confirm this is the default behavior without applying anonymous' hack? Maybe something changed in gedit itself.
This is really useful. I'm having trouble with changing case though. \L and \U don't work on backreferences in the replace field to change the case to upper. Does anyone know how to change case?
@Ironarjen it does work, but unfortunately it's not integrated into the main search/replcace dialogs. You have to use the menu Search > Regular expression (since there isn't a keyboard shortcut either).
There is no way to make the plugin work in Gnome 3. Plugins for Gnome 2 are built in Gtk+2 but plugins for Gnome 3 are built in Gtk+3. I've run into this problem with other plugins I use that to run in Gnome 3 they require a complete recoding so until then we are out of luck, which is unfortunate because I really love this plugin.
Ben,
Do you have any plans to update the plugin to gnome 3 or should those of use on gnome 3 look for another solution?
How do I get this work on gedit/gnome 3? I placed it under .local/share/gedit/plugins but it doesn't work, and https://code.google.com/p/a... is total crap
What are the dependencies for your plugin? I'm running Arch-Linux with gnome3. I used the gnome3 version of the plugin I found at the gnome3 gedit plugins page but when I click "Regular Expression..." from the Search menu in gedit I get a blank frame that pops up. I haven't seen this happen with anything else so I figure it must be the dependencies you are using but any other suggestions are welcome. Thanks for your work!
@edek: doesn't work for me (Ubuntu 11.10) and I tried placing it both in ~/.local/share/gedit/plugins (note: the gedit folder didn't exist, I created it myself) and /usr/share/gedit/plugins, to no avail; no menu entry, and no item in the plugin list (in the preferences dialog). Can you give some details on your system?
Thanks for the plugin, very nice. For those complaining you can't replace with nothing, just type a space then delete it. Maybe that's something new though?
Tried many folders, like usr/lib/gedit/plugins, ~/.local/share/gedit/plugins and ~/.gnome2/gedit/plugins and nothing.
I think my problem is because my gedit is V3. Can you help me with hints about what to do? I am really addicted to regular expressions, but really newbie on linux systems. So things like compile/build/make myself are still a mistery.
Tried many folders, like usr/lib/gedit/plugins, ~/.local/share/gedit/plugins and ~/.gnome2/gedit/plugins and nothing.
I think my problem is because my gedit is V3. I am really addicted to regular expressions, but really newbie on linux systems. So things like compile/build/make myself are still a mistery.
Can you help me with any hints about what to do in order to gedit reconigze your plugin?
Working perfectly now. Congrats to Daniel d'Andrada T. de Carvalho and Ben Fisher, youre the guys. Because of your initiative, now i'm very tempted to learn a bit of python and plugin development.
This is pretty damn cool. You've really saved the day.
I hope I may help by making a suggestion. Would you please make it key into Gedit's 'Undo' function? It presently undoes (gedit2) the action prior to the regex command, or indeed any number of regex commands. I could regex for half an hour but undo would still undo the op before the first regex command was executed and therefore wipe out the whole lot.
Some time ago, I forked this plugin and made some significant changes on it. It supports an accel key (Control+R), highlights found text, etc. Also, I put it in a bitbucket project, so I bet it will be easier to manage the various versions and to fork it: https://bitbucket.org/brand...
BTW, I recently ported it to Gedit 3, which seems to be a very required feature - already provided by Jack Baucum, but anyway, it is available there too :)
I have gedit 3.4.1 on ubuntu 12.04 and I have some bugs with you plugin. Could you please fix it?
1. When I start gedit, the regexp dialog appears on screen for about 1 second and than it hides and gedit loads. 2. When I enter some text in regexp dialog in text field, I see no cursor blinking at all, text is editable, but no cursor indication!
I just wanted to mention this is a great plugin. I am just having this one issue. I am on Ubuntu 12.04 and using gedit v3.4.1.
The first time i open the plugin it works fine, then if i close it and try to open it back up in the same gedit session, i can only see the title bar of the dialog. When i go to expand the content below the title bar it appears all blank.
Great hack, Ben-- you and Nickleus saved my day! --after spending half of it trying to get a regex S/R in gedit, with your help I have now accomplished something... Thanks!
I'm using Ubuntu 14.04. There is no longer a ~/.gnome2/gedit/plugins directory. Is this to do with Ubuntu 14.04 using Gnome3? Into which directory should I put the plugin?
Thanks everyone for the feedback and information. Current gedit has a built-in replace-with-regular-expression feature, so this plugin isn't needed anymore.
Question: Is it possible to use Ctrl-H shortcut? Or add a shortcut for it, at least.
I'll test later!
Thank you!
I'm commenting just to thank you for the work. It's being useful.
Best,
Rafael.
I agreed with Waldir, being able to replace text with nothing (delete) is very useful.
It looks like the '^' is not bound to the start of the current line, it's bound to the point where the search begins. Being cautious, I used 'find' a few times before doing the replace all. It steps through multiple matches on the same line.
My wishlist:
1. Fix the above
2. Add a hotkey to bring up the dialog
3. Add a replace and search again button with keyboard shortcut.
It's nearly there.
I've been using nedit, which is not bad, except that it doesn't understand the gnome virtual file system, which would be much more convenient sometimes.
Thanks for the awesome plugin. Hope I have the skills to write these sorts of things one day.
Nick
Many thanks!
Otherwise, very useful.
Small bug though: when there is 2 successive matches the second one isn't caught.
Example: when using "<.+?>" on "this is a test test" the < /b> isn't caught.
What im missing:
-) Shortcut or merge with standard replace strg+h
-) Dont disable replace buttons when replace field is empty
----
if len(search_text) > 0 and len(replace_text) > 0:
----
to
----
if len(search_text) > 0:# and len(replace_text) > 0:
----
and save, the program will not disable the replace all button. (but I'm not sure if it will break it in anyway - I hope not).
I'm trying to add text at the beginning of each line:
match: '\n'
replace: '\n2010-09-17,'
the match works but the replace not.
Granted, this is not a complete solution, since not always you'll have newlines in the search field, but as I said, it's a workaround :)
Btw, thanks anonymous (↑↑) for the empty string replace trick! However, I think I don't recall doing it, and nevertheless the replace button doesn't get deactivated when the replace field is empty (I can't remember when it stopped doing that). Can anyone confirm this is the default behavior without applying anonymous' hack? Maybe something changed in gedit itself.
gedit really needed some regex support
Very easy to use
That's actually better than most plugins I've tried which just crash gEdit!
It would be nice to know which bits I really need and where they need to be located in Windows or the gEdit structure?
There is no way to make the plugin work in Gnome 3. Plugins for Gnome 2 are built in Gtk+2 but plugins for Gnome 3 are built in Gtk+3. I've run into this problem with other plugins I use that to run in Gnome 3 they require a complete recoding so until then we are out of luck, which is unfortunate because I really love this plugin.
Ben,
Do you have any plans to update the plugin to gnome 3 or should those of use on gnome 3 look for another solution?
thanks alot.
Works great on Ubuntu 10.04.2 LTS.
Great help for editing srt-files.
webe
PS. minor request: remember regex
Ubuntu 11.10+ uses Gnome 3.
I use ubuntu 11.10.
That works for me (assume that your downloaded file is called regex.tar.gz):
tar xzvf regex.tar.gz
mkdir -p ~/.local/share/gedit/plugins
mv regex_replace ~/.local/share/gedit/plugins
start gedit
open preferences window, plugin should appear in the list
http://nickhumphreyit.blogspot.com/2012/01/how-to-install-gedit-regexregexp-plugin.html
http://askubuntu.com/questi...
Tried many folders, like usr/lib/gedit/plugins, ~/.local/share/gedit/plugins and ~/.gnome2/gedit/plugins and nothing.
I think my problem is because my gedit is V3. Can you help me with hints about what to do? I am really addicted to regular expressions, but really newbie on linux systems. So things like compile/build/make myself are still a mistery.
Thanks in advance
http://askubuntu.com/questi...
Tried many folders, like usr/lib/gedit/plugins, ~/.local/share/gedit/plugins and ~/.gnome2/gedit/plugins and nothing.
I think my problem is because my gedit is V3. I am really addicted to regular expressions, but really newbie on linux systems. So things like compile/build/make myself are still a mistery.
Can you help me with any hints about what to do in order to gedit reconigze your plugin?
Look at the above comments. The Gnome3 version of the plugin is at http://live.gnome.org/Gedit...
I will try it at home.
Thanks
sudo apt-get install geany
I hope I may help by making a suggestion. Would you please make it key into Gedit's 'Undo' function? It presently undoes (gedit2) the action prior to the regex command, or indeed any number of regex commands. I could regex for half an hour but undo would still undo the op before the first regex command was executed and therefore wipe out the whole lot.
Cheers.
links to new version of this plugin look here: http://nickhumphreyit.blogs...
download here:
http://live.gnome.org/Gedit...
Some time ago, I forked this plugin and made some significant changes on it. It supports an accel key (Control+R), highlights found text, etc. Also, I put it in a bitbucket project, so I bet it will be easier to manage the various versions and to fork it: https://bitbucket.org/brand...
BTW, I recently ported it to Gedit 3, which seems to be a very required feature - already provided by Jack Baucum, but anyway, it is available there too :)
I have gedit 3.4.1 on ubuntu 12.04 and I have some bugs with you plugin. Could you please fix it?
1. When I start gedit, the regexp dialog appears on screen for about 1 second and than it hides and gedit loads.
2. When I enter some text in regexp dialog in text field, I see no cursor blinking at all, text is editable, but no cursor indication!
Thank you! Nice day!
The first time i open the plugin it works fine, then if i close it and try to open it back up in the same gedit session, i can only see the title bar of the dialog. When i go to expand the content below the title bar it appears all blank.
Thanks!
http://files.bachsau.com/pl...
John