Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

in Gedit Can I use image tag for find and replace with a space.
I simply need to remove entire image tags in the html Using Find & Replace

share|improve this question

migrated from stackoverflow.com Jan 21 '10 at 11:04

This question came from our site for professional and enthusiast programmers.

    
THis would be better suited on Superuser. –  Bobby Jan 21 '10 at 10:07
    
For one, this should be on Stack Overflow. The part about how to open search and replace is for SU, but the part about how to create a regex to replace image tags should be on SO. (where it will ultimately be shunned for trying to use regex to parse HTML) –  Hello71 Jul 20 '10 at 17:29
add comment

1 Answer 1

You will need the "Regex Search & Replace" to do this. Here's how to install the plugin:

  • Download: http://vaem.googlecode.com/files/gedit2_regex_replace_plugin.tar.gz
  • Open Nautilus and go to this directory: ~/.gnome2/gedit/plugins (create all of them if necessary)
  • Extract the contents of gedit2_regex_replace_plugin.tar.gz in ~/.gnome2/gedit/plugins (make sure that at the end you will have a directory named regex_replace and a file named regex_replace.gedit-plugin inside ~/.gnome2/gedit/plugins)
  • Now enable the plugin: Edit -> Preferences -> Plugins tab and check "Regex Search & Replace"
  • Click the Close button
  • Now let's use this plugin: press Control + Alt + H
  • In "Search for" write the following regexp: <img(.*)(/>|></img>)
    • (This should be enough to catch both "new" and "old" style img tags)
  • The plugin won't let your replace with an empty string so either push "Find" and manually delete all occurrences or insert a blank space and click "Replace all"
    • (Anyway I suggest to use "Find and Replace" so that you have a chance to review what is going to be removed).
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.