...

View Full Version : Search and replace programs? Anyone?



cortic
02-10-2003, 10:00 AM
The problem is a menu table, now this isn't 'exactly' the same on every page but it is on more than 90 pages and I need to add a cell with onmouseover, CSS class and color attributes.. and inside it needs to be a link with the same class and onmouseover.. yea?

It would be SO simple if I could put in document.getElementById('main_tab') to the program (to reference it by the object ID) but few programs even take tags into consideration never mind IDs, I'm trying to write something to do this in perl, but my skills in that language are mediocre at best.

If anyone knows of any search - replace programs that could do this.. I'd really appreciate it.

Thanks.

meow
02-10-2003, 10:54 AM
Is there something in the tag that is unique? And how much do you need to replace? Just the <tag> or <tag>content</tag>

cortic
02-10-2003, 01:12 PM
Is there something unique? Yea the id tag lol{<table id=”main_tab”>} -- I really need to replace the table with a brand new one (its actually not much different - a new cell and info in the cell), got any programs in mind?
The link names are all the same too ( a href= inside the cells).. I think their all going to the right place (lol)

meow
02-10-2003, 01:23 PM
Well, 'my' texteditor (http://notetab.com) can do it but it still would take some scripting so it isn't plug and play.

So maybe Perl as you suggested is a better solution.

tommysphone
02-10-2003, 02:43 PM
Perhaps that might have what you want.

beetle
02-10-2003, 03:16 PM
Show us the text you want to 'find' and that which you want to 'replace' it with.

cortic
02-11-2003, 02:36 AM
Beetle - listed the before and after, the percentages need changing too, but you get the idea.. where I say 'misc changing info' I literally mean that this is different on every page.. also the spaces and carriage returns (\n) are different per page (it was originally created by someone else on dreamweaver), I have drop-down tables generated by JavaScript in a js file (all the script needs to work is the percentages) I should just have dynamically generated the links on this table too, but they were already in place when I got the job...

Meow - thanks, I'll try it...




<table id="main_tab" width="98%" border="1" height="73">
<tbody><tr bgcolor="#003366">
<td id="pannel" class="main_lnk" width="15%" align="center" onClick="o_min(0)">
<a class="main_lnk" onmouseOver="shw_it(0)" href="javascript:o_min(0)">Link1</a>
</td>
<td class="main_lnk" width="17%" align="center" onClick="o_min(1)">
<a class="main_lnk" onmouseOver="shw_it(1)" href="javascript:o_min(1)">Link2</a>
</td>
<td class="main_lnk" width="15%" align="center" onClick="o_min(2)">
<a class="main_lnk" onmouseOver="shw_it(2)" href="javascript:o_min(2)">Link3</a>
</td>
<td class="main_lnk" width="19%" align="center" onClick="o_min(3)">
<a class="main_lnk" onmouseOver="shw_it(3)" href="javascript:o_min(3)">Link4</a>
</td>
<td class="main_lnk" width="18%" align="center" onClick="o_min(4)">
<a class="main_lnk" onmouseOver="shw_it(4)" href="javascript:o_min(4)">Link5</a>
</td>
<td class="main_lnk" width="16%" align="center" onClick="o_min(5)">
<a class="main_lnk" onmouseOver="shw_it(5)" href="javascript:o_min(5)">Link6</a>
</td>
</tr>
<tr onmouseOver="shw_it(6)">
<td colspan="6" height="42">
<div id="blurb_it" align="center">
<p><font face="Comic Sans MS" size="-1" color="#cc0000"><b>Misc [changing] info</font></b></font></p>
</div>
</td>
</tr>
</tbody></table>

to

<table id="main_tab" width="98%" border="1" height="73">
<tbody><tr bgcolor="#003366">
<td id="pannel" class="main_lnk" width="15%" align="center" onClick="o_min(0)">
<a class="main_lnk" onmouseOver="shw_it(0)" href="javascript:o_min(0)">Link1</a>
</td>
<td class="main_lnk" width="17%" align="center" onClick="o_min(1)">
<a class="main_lnk" onmouseOver="shw_it(1)" href="javascript:o_min(1)">Link2</a>
</td>
<td class="main_lnk" width="15%" align="center" onClick="o_min(2)">
<a class="main_lnk" onmouseOver="shw_it(2)" href="javascript:o_min(2)">Link3</a>
</td>
<td class="main_lnk" width="19%" align="center" onClick="o_min(3)">
<a class="main_lnk" onmouseOver="shw_it(3)" href="javascript:o_min(3)">Link4</a>
</td>
<td class="main_lnk" width="18%" align="center" onClick="o_min(4)">
<a class="main_lnk" onmouseOver="shw_it(4)" href="javascript:o_min(4)">Link5</a>
</td>
<td class="main_lnk" width="16%" align="center" onClick="o_min(5)">
<a class="main_lnk" onmouseOver="shw_it(5)" href="javascript:o_min(5)">Link6</a>
</td>
<td class="main_lnk" width="16%" align="center" onClick="o_min(6)">
<a class="main_lnk" onmouseOver="shw_it(6)" href="javascript:o_min(6)">Link7</a>
</td>
</tr>
<tr onmouseOver="shw_it(6)">
<td colspan="6" height="42">
<div id="blurb_it" align="center">
<p><font face="Comic Sans MS" size="-1" color="#cc0000"><b>Misc changing info</font></b></font></p>
</div>
</td>
</tr>
</tbody></table>

WA
02-11-2003, 02:58 AM
Well, when I changed the name of JavaScriptKit.com (from Wsabstract.com), I needed something robust to recognize various matches, such as WA, Website Abstraction, Wsabstract.com etc. Finally found a search-and-replace program that allowed to me to just that, called ReplaceEm 2.0:

http://download.com.com/3000-2248-4931801.html?legacy=cnet

Worked like a charm. Supports wild cards, so it's up to you to come up with the appropriate formula.

cortic
02-11-2003, 04:46 AM
WA - hmm, I had a look at that one, didn't know it had wildcards.. I skipped it cause it didn't look like it could understand tags, will give it another shot, by the way I remember the change, and I think I remember that thread.. I wanted to keep abstract lol.

Meow - that is a funky notepad lol, I've been using the standard MS txt reader for all my code, not sure if its going to help me with this, but I'm certainly going to get into it, looks handy as hell.



thanks.

cortic
02-11-2003, 03:40 PM
WA - thanks, I think this is gona do, one thing, you don't know how to put carriage returns into it.. do you? (\n).. I read through the help, searched there site.. even run a search on altavista lol. ( I've tried {}r {}n and actual returns followed by an * ) I have it on 'regular expression search' and think I have everything else working.

WA
02-11-2003, 11:57 PM
Originally posted by cortic
WA - thanks, I think this is gona do, one thing, you don't know how to put carriage returns into it.. do you? (\n).. I read through the help, searched there site.. even run a search on altavista lol. ( I've tried {}r {}n and actual returns followed by an * ) I have it on 'regular expression search' and think I have everything else working.

Hmmm...honestly I can't tell you, since it's been a long time since I last used the program.

pb&j
02-12-2003, 05:15 AM
Originally posted by cortic
WA - thanks, I think this is gona do, one thing, you don't know how to put carriage returns into it.. do you? (\n).. I read through the help, searched there site.. even run a search on altavista lol. ( I've tried {}r {}n and actual returns followed by an * ) I have it on 'regular expression search' and think I have everything else working.

Just a guess, but try...
^P

cortic
02-12-2003, 02:14 PM
Thanks for the suggestion pb&j, it was '{}e' found it by mistake lol (the prog replaces actual carriage returns with {}e after the edit window is shut down and opened again)

Have another issue with this, maybe this is more global though, so I hope someone can help, in ranges the prog searched ASCII text like [a-z]* is searching for anything from ASCII a to z and stopping when it finds something else (like a space or a cap or something).. does someone know (or have a link to) the full ASCII character list.. in order? This is so I can allow for things inside the element on the page, so I can add non-alphanumerical characters into range searches.

Thanks.

joh6nn
02-12-2003, 11:31 PM
i've tried ReplaceEm, but i was much happier with the following program:

http://www.silveragesoftware.com/hffr.html

it has a better interface, i think, and allows for regular expressions, searches by date, and a couple of other nice features.

cortic
02-13-2003, 03:48 PM
thanks joh6nn, its incredibly user friendly! I get the feeling there is more I could do with ReplaceEm but I think this is going to do for now (hopefully).

does anyone know the ASCII character order? I'm interested to know this anyway cause it seems to be a pivotal point of these search programs..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum