-1

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"
2
  • What do you want to happen here? Do "Test1", "Test2" and "Test3" all get replaced by the same string or different strings?
    – ChrisF
    Commented Mar 12, 2012 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
    Commented Mar 12, 2012 at 13:49

2 Answers 2

3

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="[^"]*"
6
  • can you recomment any software that could do it?
    – Sifr87
    Commented Mar 12, 2012 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
    Commented Mar 12, 2012 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. Commented Mar 12, 2012 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. Commented Mar 12, 2012 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
    Commented Mar 12, 2012 at 13:53
1

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).

You must log in to answer this question.

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