Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking to mass remove in notepad find and replace

Status
Not open for further replies.

cdiross

Technical User
Oct 23, 2006
290
US
Hi, I have the following variables listed as [1], [2] all the way to 300 in brackets. I'd like to remove anything and blank out

I've tried [?], [*.*] in find
and replace I leave blank because I don't want anything to but space to replace it.

Nothings working. Can anybody help?

thanks
 


Do 10 Find & Replaces for...

0
1
2
3
4
5
6
7
8
9


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I have dates I need to keep. It has to be a find including the brackets.
 




Is there anything else that you have not disclosed regarding the requirements for this exersize?

Maybe post a few rows of data, that demonstrate the challenge at hand?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Sorry.

Every line of code is like this

<td><a href=" title="Aurel Joliat">Aurel</a>, <a href=" title="Rene Joliat">Rene</a></td>
<td><span class="flagicon"><a href=" class="image" title="Flag of Canada.svg"><img alt="" src=" width="22" height="11" border="0" class="thumbborder" /></a>&#160;</span><a href=" title="Canada">Canada</a></td>
<td><sup id="cite_ref-96" class="reference"><a href="#cite_note-96" title="">[97]</a></sup></td>
 
Wait, are there values that should replace 1-300? Like 1=ABC, 2=DEF, 3=GHI, etc.?

If so, you could build a table of the codes and loop through with VBA.

If all you want to do is delete anything within square brackets (along with the brackets) then I'd open the file in Word instead of WordPad. Word has an option of "Use Wildcards," unlike WordPad.

You might run into problems using brackets, though. If so, replace them with characters that aren't found anywhere else in your document. For example, you could replace [red][[/red] with [blue]|[/blue] and [red]][/red] with [blue]~[/blue].

Then, in Word, you can Find and Replace "|*~" with "" (without quotes, of course) and Replace All.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 




You're going to have to use code. I am not an expert with regular expressions, but there are contributors here that can help you with them.

Best I could personally recommend is to dump it into Excel and then design a macro to loop to find the values within the brackets and replace.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
That's way over my head. I only want to replace the brackets with any value between them to nothing. Basically replace it with an empty space. Like above I simply want to remove [97] to have an empty space.
 
-> I only want to replace the brackets with any value between them to nothing

I realize I was a bit late to the party, but my previous post will allow you to do just that without any coding.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
I tried to replace [*.*] in word checking off "use wildcards" and it's not working.
 




Please read John's explanation closely.

IT WORKS!!!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Any luck?

If you try to Find [highlight][*][/highlight], it won't work. You need to replace the square brackets with other characters.

The [[highlight]|[/highlight]] is the "pipe". On standard US keyboards, it is the shifted-character on the [\] key, just above [Enter]. The [[highlight]~[/highlight]] is the tilde, the shifted-character for th [`] key at the top-left corner of the keyboard to the left of [1].

If either of these characters appear elsewhere in your document, choose another character that doesn't.

The left- and right-square brackets must be replaced with two different characters.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Let me see if I can help.

You have [97], right?

What anotherhiggins is suggesting is that you replace the square brackets first, say with | and ~.

Getting |97~

NOW you can use another Replace. In anotherhiggins' words (from his post):
Then, in Word, you can Find and Replace "|*~" with "" (without quotes, of course) and Replace All.
Although if is true that you want to: "Like above I simply want to remove [97] to have an empty space.", then you may want to change the Replace from "", to " ".

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top