Search and Replace

Previous answer
Main page of Friday 101
Next answer

Search/Replace the current FAQ
While editing an answer or template, press Ctrl+R to bring up a dialog where you specify the text to search for and replace with. This works only within the current answer or template you're editing.

One-shot Whole-FAQ Search and Replace
After clicking any question in the main Friday screen, press Ctrl+R to get a search/replace dialog.

Fill in the text to search for, the text to replace it with and whether or not you want the search to be case sensitive, then click Replace. Friday searches for the search text in every answer in your FAQ and replaces it with the replacement text.

If you don't fill in Search for text, nothing happens when you click Replace, but it's possible to replace the Search For text with nothing if you put nothing in the Replace text box.

Batch Search and Replace

While editing an answer or template, press CTRL+F to have Friday automatically perform a whole list of search/replace operations on just the current answer or template you're editing.

To set up Batch S&R, add the following to FRIDAY.INI in the directory where FRIDAY.EXE is installed

[SearchAndReplace]
SearchAndReplace=SR.TXT

SR.TXT is the name of the file where you will store your search/replace settings
Use a different name if you like, eg
SearchAndReplaceFile=FRED.DOC

Since this is a main FRIDAY.INI setting and not an FAQ-level setting, you only need to do it once and it applies to all FAQs that you maintain with this copy of Friday.

SR.TXT must be in the same directory as FRIDAY.EXE

In SR.TXT enter your search/replace text as follows:

<hr>=<hr />
<br>=<br />
<b>=<strong>
</b>=</strong>

In other words, searchtext=replacetext, the text you want to search for on the left of the = sign, the text you want to replace it with on the right.

Use lowercase search strings and Friday will replace the uppercase versions as well.
For example:

<B>=<strong>
<b>=<strong>
</B>=</strong>
</b>=</strong>

and just

<b>=<strong>
</b>=</strong>

are equivalent.

Of course, you could also use this feature for other purposes, like replacing shorthand:

sr=Steve Rindsberg

would replace all instances of sr or SR with my name. Be a bit cautious here to avoid "snake eating tail syndrome" If you replace text with text that contains the string you're searching for or use shorthand that might be used in other words, things can get ugly.

Consider:

is=Igor Stephanis

See the problem? Igor Stephanis contants "is", the text you're searching for, so it could send poor Friday off into the ozone forever. Also, other words may contain the letters "is" and they'd get replaced too, leading to some very odd results.

Instead, use:

!is=Igor Stephanis

Put the "Bang" (!) or some other character in front of your shorthand entries and you'll be safe.

Here's an example replacement file:

; Lines beginning with a semicolon are comments
; The semicolon must be in the first character position on the line
; Blank lines are ignored
; Lines w/o an equals sign are ignored

; replace old BOLD and ITALIC code with strong, emphasis code
<b>=<strong>
</b>=</strong>
<i>=<em>
</i>=</em>

; uncapitalize this stuff
; note that we leave final > out of opening tag - takes care of things like <table param="yada">
;TABLES
<table=<table
</table>=</table>
<tr=<tr
</tr>=</tr>
<td=<td
</td>=</td>
; HEADINGS
<h=<h
</h=</h
<p=<p
</p>=</p>
;LISTS
<ul=<ul
</ul>=</ul>
<ol=<ol
</ol>=</ol>
<li=<li
</li>=</li>
; LINKS
<a href=<a href
<img src=<img src
; MISC
<center=<center
</center>=</center>
<br>=<br>
<hr>=<hr>
; PARAMS
width=width
height=height


Filename: FAQ00156.htm
Last edited on 10/31/2004 3:05:47 PM

Naturally, all content & site maintenance by

Friday The Automatic FAQ Maker