Find and Replace using different keywords

-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"

Sifr87

Posted 2012-03-12T13:23:59.500

Reputation: 1

What do you want to happen here? Do "Test1", "Test2" and "Test3" all get replaced by the same string or different strings? – ChrisF – 2012-03-12T13:26:53.490

for example there is this one file that contains "Test1", "Test2" and "Test3", i want to get rid of them in one click.. – Sifr87 – 2012-03-12T13:49:57.163

Answers

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="[^"]*"

Der Hochstapler

Posted 2012-03-12T13:23:59.500

Reputation: 77 228

can you recomment any software that could do it? – Sifr87 – 2012-03-12T13:43:19.997

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 – 2012-03-12T13:47:50.397

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. – Der Hochstapler – 2012-03-12T13:49:34.890

Ok, I thought I've understood what you want to achieve, but I haven't. Please explain it in more detail in your question. – Der Hochstapler – 2012-03-12T13:50:53.813

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 – 2012-03-12T13:53:20.310

I added an example for you into my answer. I hope it helps :) – Der Hochstapler – 2012-03-12T14:00:16.517

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

tidbeck

Posted 2012-03-12T13:23:59.500

Reputation: 1 365