Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Example. I want to find and replace using:

Test1
Test2
Test3

Of course I have to input and click it 3 times in order for me to find and replace using those terms. How do I do it in one shot?

Does it work with:

class="tbc" 
class="tbd" 
class="tbc-r" 
class="tbd-r" 
class="tbd-c" 
class="tbc-r" 
class="tbh" 
class="tbsh"
share|improve this question
    
What do you want to happen here? Do "Test1", "Test2" and "Test3" all get replaced by the same string or different strings? – ChrisF Mar 12 '12 at 13:26
    
for example there is this one file that contains "Test1", "Test2" and "Test3", i want to get rid of them in one click.. – Sifr87 Mar 12 '12 at 13:49

Notepad doesn't support wildcards (let alone regular expressions) in its text substitution process.

So, no, there is no easier and/or faster way than emitting 3 instructions.

If you're allowed to look into alternatives, you might be able to achieve what you're looking for by using the free text editor Notepad++. Here I made a quick example that uses a simple regular expression Test\d to match the lines in that file.
enter image description here
Then I just click Replace All and removed all occurrences in one go:
enter image description here

I hope that's what you're looking for.


For completeness sake, this is the regular expression which I sent you via email to match your class= parts:

class="[^"]*"
share|improve this answer
    
can you recomment any software that could do it? – Sifr87 Mar 12 '12 at 13:43
    
what im trying to do is find and replace using different keywords in one file. What i want is to remove it by clicking one.. – Sifr87 Mar 12 '12 at 13:47
    
Notepad++ is a very popular, free text editor that has extensive text replacement support. Most likely, you'll be able to achieve what you're looking for. – Oliver Salzburg Mar 12 '12 at 13:49
    
Ok, I thought I've understood what you want to achieve, but I haven't. Please explain it in more detail in your question. – Oliver Salzburg Mar 12 '12 at 13:50
    
for example there is this one file that contains "Test1", "Test2" and "Test3", i want to get rid of them in one click.. i just need a text editor that can find and replace using multiple keywords – Sifr87 Mar 12 '12 at 13:53

Vim will of course do this, as any other text editing task you can imagine. The problem is that it may take a while to learn if you never used it.

Anyway, this is how:

:%s/Test1\|Test2\|Test3//g

It's search and replace using regexp. The part between the first and second /, is the search string and between second and last the replacement string (in this case empty).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .