PPTools/Guiguts/Guiguts 2 Manual/Search Menu
GUIGUTS VERSION 2 MANUAL
Describes features included in release 2.0.0 (July 2025)
Search Menu
The Search & Replace Dialog
Use ctrl-f, or Search>Search & Replace to open the search dialog:
- SCREENSHOT: Search/Replace dialog with multi turned off
The search dialog remains open until you close it. You can move and resize it, and make it wider if you need to search for long phrases.
Basic Searching
Search & Replace can find exact text or text that matches a pattern. See Regular Expressions, below, for information about pattern matching. To find exact text:
- type or paste the text into the Search Text box (if it's already open), or highlight the text in the main window and use ctrl-f, or Search>Search & Replace. When you do any of these, focus will move to the Search & Replace dialog, opening if it was not already open, and with the selected text (if any) in the Search line.
- to find Foot but not foot, set Match Case on.
- to find both foot and footnote, set Whole Word off.
- to avoid having punctuation like [Foot misinterpreted, set Regex off (regular expressions discussed below).
- to search backward instead of forward from the current position, set Reverse on.
- turning Wrap Around on will cause the search to wrap, e.g. if a search forward does not find a match before reaching the end of the file, the search will continue from the top of the file.
- make sure regex is not set, then click Search.
Guiguts searches for the text. If it is found, Guiguts scrolls the document to display the found text, sets the insertion point before its first character, and selects the found text.
Change the setting of Reverse to continue a search backward in the direction from which it came.
When the text is not found, Guiguts sounds the bell.
First/Last Match
The First button (labelled Last if Reverse is turned on) finds the first (or last) match for the search in the file. This may be useful when starting a new search or if you wish to restart an existing search to check through all the matches again.
Search and Selections
If a selection is active before you open the Search dialog, up to one line of the selection is copied into the Search Text field for you. Thus if you want to look for a particular word or phrase from the text, just select it and key ctrl-f; the search is ready to use.
The dialog also has an "In Selection" checkbox which affects the behavior of the buttons under it, i.e. Count, Find All and Replace All. If "In Selection" is checked, then those buttons either count, find or replace all the occurrences within the current selection only. The "In Selection" box does not affect the behavior of the other buttons on the dialog. For example, the Search button will still find the next occurrence of a string, even if that is outside the current selection, ignoring the "In Selection" setting.
Replacing
To replace the found text, enter the new text in the Replacement Text field. Click Search to find the first or next target. To test a replacement, click Replace and observe the results; if they are not satisfactory, click the Undo button next to the Search button, or use Undo. If the replacement is for a large chunk of text covering several lines, instead of using Undo, it is better to save the file before replacement, and if the results are not satisfactory, load the saved file and try again - more details here.
To replace some targets and not others, click Search until you reach a target that needs replacement. Then click R & S (Replace and search again).
When the Replacement Text field is empty, replacement amounts to deletion.
To perform a global replacement, click Replace All. Guiguts repeats the search and replace operation from the current position to the end of the document. If Wrap around is on, it will continue from the start of the document until it reaches the previous current position again, thus replacing all occurrences in the file.
Shift-clicking the Replace All button in the S/R dialog replaces all identical matches to the current match. An example would be to search for words in italic markup, then if a LOTE word is found, all occurrences of that LOTE word can have a `lang` attribute added.
If the "In selection" checkbox is on, then Replace All only replaces occurrences within the current selection, not the whole file.
The search dialog can store up to ten different replacement values. Click the Multi-replace button to reveal them, and enter the number of replacement fields wanted in the spinbox:
- SCREENSHOT with multi turned on
Use the mouse to click on Replace, R & S, or Replace All opposite the replacement you want to make.
NOTE:
Number of Occurrences of the Search string
Click the "Count" button to see the number of occurrences of the Search string. This works for normal text and regular expressions.
If the "In selection" checkbox is on, it only counts what's in the selection.
Search History
Each Search or Replace field has a dropdown arrow, that gives access to the last 10 search or replace patterns you have used. You can select a pattern from the menu; it is loaded into the text field. This feature allows you to recall patterns that you used previously without having to re-enter them. The saved patterns are remembered from one session to the next.
- SCREENSHOT of S/R history dropdown
S&R Keyboard shortcuts
The following keyboard shortcuts ("hot-keys") are available when the Search dialog is open:
Keyboard focus in document window or in search dialog | |
ctrl-f (cmd-f on Macs) | Search (opens Search dialog if necessary, copies selected text, if any, to the Search line; focus moves to search dialog) |
F3 (cmd-g on Macs) | Search again (focus remains where it was) |
shift-F3 (shift-cmd-g on Macs) | Search in reverse (focus remains where it was) |
Keyboard focus in search dialog | |
Enter | Search in direction indicated by Reverse checkbox |
shift-Enter | Search in opposite direction to Reverse checkbox setting |
ctrl-Enter (cmd-Enter on Macs) | Replace using first field and Search again in direction indicated by Reverse checkbox |
shift-ctrl-Enter (shift-cmd-Enter on Macs) | Replace using first field and Search again in opposite direction to Reverse checkbox setting |
Hold Shift while clicking Search or R & S | Search or Replace & Search in opposite direction to Reverse checkbox setting |
Find All
Using this option brings up a list of all the locations in the file where the search term is found.
- SCREENSHOT: Find all
Since the whole line is included in the Find All dialog, you can see the local context, and can left-click to jump to that point in the file, or right-click to remove the entry from the Find All list.
Highlight All
This button causes all matches for the current search term to be highlighted in the main text window. If the search term is "word", then all occurrences of "word" will be highlighted. The highlight refreshes regularly, so if you add another occurrence of "word", that will be highlighted too. However, if you change the search term to "something else", the program will continue to highlight "word" until/unless you click Highlight All again, when it will start to highlight occurrences of "something else".
Regular Expressions
A regular expression is a formal way of describing a pattern of text. You use regular expressions (regexs for short) when you need to search, not for a specific string like Foot, but for any string that fits a certain pattern. To search for a pattern of text, type the pattern into the Search Text field and set the Regex switch on.
Regular Expression Resources
Regular expressions are amazingly powerful and flexible tools, if you understand their terse and technical syntax. Knowing how to create and use them is essential to doing post-processing. This manual does not attempt to teach you how to construct regular expressions, but there are many tutorials available on the Internet. You can try the following resources for help in mastering regular expressions (this list may not be current):
- Regex questions are asked and answered in this forum thread which begins with a tutorial.
- This wiki's Category:Regular expressions
- this site has a tutorial and links.
The remainder of this topic covers only those special features that are supported by Guiguts and not always covered in tutorials.
Regex Replacements
After you have found a string, you can cause Guiguts to replace it. The regex syntax for replacements lets you replace the found string with a mix of new text, text quoted exactly from the found text, and quoted text that you modify, for example by forcing it to uppercase.
Replacing with New Text
You find the scanner has consistently misread CHAPTER as CHAETER, CHATTER, or CHARTER. You set a regex search for CHA[ETR]TER, with the fixed replacement text of CHAPTER, and click Replace All. The found text, whatever it may be, is replaced by the new text.
Replacing by Quoting the Found Text
You use parentheses within the search pattern to isolate the parts of the found text that you want to quote in the replacement. Left-parens in the pattern are numbered 1-9, left to right.
In the Replacement Text, \1
means
"here insert the text found by the first parenthesized part of the pattern."
\2
quotes the second parenthesized bit, and so on.
NOTE: This is different to Guiguts 1, where the dollar sign was used in place of backslash
Often italic markup starts on the wrong side of punctuation,
for example <i>"Eh?"</i>
or
<i>(ibid.)</i>
. The following pattern
looks for italic markup preceding punctuation:
<i>(['"(]+)
. The parens isolate the
part of the pattern that finds the punctuation.
The replacement pattern
\1<i>
fixes the error by quoting the found punctuation
followed by italic markup, thus reversing their order.
A search pattern for trailing italics
could be ([.!;'")]+)</i>
and its
replacement would be </i>\1
.
Replacing by Modifying Quoted Text
Guiguts provides an additional custom way to modify quoted text which you will not find described in general documentation on regular expressions:
\C...\E
means that the text between \C
and \E
will be processed as a Python executable expression, and replaced with the result of the expression.
Although it requires you to know some Python, this feature can save hours of hand-labor. A persistent storage area is also available, similar to the lglobal
variable used in Guiguts 1. Use cset("v1", 23)
to store 23 in the variable v1
, and cget("v1")
to get the current value of the variable. See example of use below.
The following table describes other extended regex commands that can be used to modify the matched text.
\L...\E
|
Force all text between \L and \E to lowercase. For example, \L\1\E means, quote \1 in lowercase.
|
\U...\E
|
Force all text between \U and \E to uppercase. For example, \U\1\E means, quote \1 in uppercase.
|
\T...\E
|
Force all text between \T and \E to title case (initial cap). For example, \T\1\E means, quote \1 with initial caps.
|
\A...\E
|
Make the text between \A and \E a valid anchor name. Some text won't change, spaces in the enclosed text will be replaced with underscores, and most symbols will be discarded (see below).
|
\R...\E
|
Convert a number between \R and \E to uppercase Roman numerals.
|
\N...\E
|
Convert a number between \N and \E from upper- or lowercase Roman numerals to Arabic.
|
- EXAMPLE(S) of using the above features.
\N...\E
can be used to easily add abbr markup for Roman numerals, e.g. to change MDCCCLXXVIII to <abbr title="1878">MDCCCLXXVIII</abbr>:
Search: ([IVXLCDM]+)
Replace: <abbr title="\N\1\E">\1</abbr>
Find Next/Previous
The Find Next and Find Previous buttons repeat the most recent search completed with the Search/Replace dialog, even after the dialog has been closed.
Replace Match
After using Find Next/Previous, you can use Replace Match to repeat the most recent replacement made with the Search/Replace dialog, even after the dialog has been closed. As with all other menu buttons, you can assign a shortcut to this key using the Command Palette.
Go Back and Go Forward
These are similar to the back/forward buttons in a browser, going back to previous locations in the file. Each time the cursor is moved via a search, or by clicking on a checker message, the current location is saved into the list that is used.
Goto Menu
- SCREENSHOT: Goto Menu
This submenu of the Search Menu contains entries that jump you to a specific location in the text. Each of them is equivalent to clicking a button in the status bar.
Goto Line Number
Select Search->Goto Line Number, or click the line number (L:nn C:nn) in the status bar. Either of these will open a small dialog for going to a particular line:
- SCREENSHOT: Goto line dialog
The display scrolls to display the line you specify at the middle of the window with the cursor at the left end of the line.
Goto Page(png)
This uses the image names (e.g., p097) of the page images. Select Search->Goto Page(png), or use the keyboard shortcut ctrl-p, or click the image-number field (Img:xxx) in the status bar. Any of these will open a small dialog for going to the text of a particular page image.
- SCREENSHOT: Goto page dialog
Goto Page is only available when the file had page-separator data when it was downloaded from DP, and still had those separators the first time it was saved by Guiguts. When it does, the image number field is visible in the status bar. The first line of text from the image you specify is displayed in the middle of the window with the cursor at the left end of the line.
Goto Page Label
Goto Page Label is available only when and you have configured page labels. (If you haven't already done that, Shift-click Lbl: in the Status bar, and configure so that the label for each page is correct. Then the page label field in the status bar displays either Lbl: Pg nn or Lbl: None.
Select Search->Goto Page Label, or click Lbl: on the Status bar to open the Goto Page Label dialog:
- SCREENSHOT: Goto page label dialog
Enter the entire label of the logical page, for example Pg 206 or Pg iii, or you can omit the Pg prefix, for example 206 or iii. When you click "OK", if you've entered a page number that exists, the first line of text of that page image is displayed in the middle of the window.
NOTE: You cannot jump to a page that was designated "No Count" in label assignment, because it has no label.
Goto Previous/Next Page
These two controls are on the Status bar, on either side of See Img, as well as appearing in the Search Menu
Use the "<" and ">" buttons on the status bar to page through the text while
showing the corresponding page images in the image viewer, if Auto Image is turned on.
Find Proofer Comments ( [** notes] )
This entry displays a checker dialog that lists all the proofer comments in the text.
By clicking entries in this dialog, you can jump to the location in the file where a proofer has left a comment, and decide what to about it.
If you decide that no change is needed, you can use the Delete button to delete that proofer comment, and if a proofer has left many identical comments, you can use Delete All to remove all of the comments that match the selected one.
Find Asterisks w/o Slash
In a similar way to Find Proofer Comments (above) this lists all asterisks that are not preceded or followed by a slash. This may be useful in finding unbalanced no-wrap markers and malformed proofers' notes. If you use it, do so after you've resolved and removed all normal proofers' notes.
Highlighting Characters
The Search menu also contains commands that help you locate unbalanced quotes and other special characters. (Guiguts cannot find unbalanced quotes reliably, as it can find unbalanced parentheses, because there is no simple and reliable way to tell a straight open-quote from a straight close-quote, or a single-quote from an apostrophe, or if an omitted quotation mark at the end of a paragraph is an error.)
These commands operate on a selection. For example, select a paragraph or a passage in which you have confused or unbalanced quotes, then choose Search->Highlight Double Quotes in Selection. The double quotes in the passage are revealed in the highlight color selected on the Preferences->Appearance menu (the default color is lavender). You can highlight single quotes (apostrophes) by using "Highlight Single Quotes in Selection".
Remove Highlights
As the name suggests, this removes all highlights. The highlighting set by any of the above commands remains active until you highlight some other characters, or use the final menu item, Remove Highlights.
Highlight Surrounding Quotes & Brackets
This highlights the first occurrence of quote and bracket symbols preceding and following the current cursor position (or the current selected text if any). It is useful when looking for missing symbols that normally occur as balanced pairs. The text range does not have to be pre-selected, but the search stops within a reasonable distance from the cursor. It looks for straight and curly double and single quotes, parentheses, and square brackets, and uses different colors to distinguish them, as shown in the example below. The keyboard shortcut to toggle it is ctrl+; (hold down the Ctrl key and press semi-colon). The keyboard shortcut ctrl+0 also removes the highlights. (When this example was made, the cursor was positioned on the fourth line, after the word "Pacific", making the "c" look a bit like a "d".)
- SCREENSHOT: Show highlighted quotes/brackets surrounding cursor
Highlight Alignment Column
This creates a vertical green line highlighting all characters at the cursor's offset position.
SCREENSHOT: Show alignment column
It's intended to make it easier for you to align Plain Text, usually in simple tables, without having to use ASCII Table Effects or trying to guess how many spaces to insert or delete. This situation usually arises when text crosses page boundaries and was formatted by different people. The green line stays in position as you scroll and add/delete spaces.
Nothing will be highlighted on lines shorter than the cursor offset position, as there will not be any characters to highlight there.
Highlight Proofer Notes
This highlights proofer notes so they are easier for the PPer to spot while they are working.
Highlight HTML Tags
This highlights HTML tags in the file, using specific colors for some common tag types, such as paragraph tags, a general color for less common tags, and a warning color for invalid tags, such as a misspelled tag name, like "sapn" instead of "span".
SCREENSHOT: Show HTML tag highlighting
Bookmarks
The Bookmarks submenu of the Search menu gives you the tools to set up to five bookmarks in the file, and return to them with a single keystroke. Each bookmark marks a location in the file, and also the current selection if there is one. This feature can be particularly useful when several operations are necessary on a specific area of the file, such as a large table.
- SCREENSHOT: Bookmarks menu
Bookmarks are remembered across sessions for each file. They are stored in the '.json file associated with the text file, so they will be lost if that file is lost; see this page.
With a little practice you will find it most convenient to set and use bookmarks using the keyboard shortcuts shown in this menu. The bookmarks are numbered from 1 to 5.
Use ctrl-shift-n (where n is a number between 1 and 5) to set bookmark n at the current position.
Use ctrl-n to jump the insertion point directly to bookmark n.
Note for macOS users: This is one of the rare places in Guiguts that uses the ctrl key, rather than the cmd key. On some systems, the shortcuts ctrl-1, ctrl-2 or ctrl-3 may default to meaning switch to virtual desktop 1, 2 or 3.
Step Through Proofer Markups
You can use the Search & Replace dialog to step through proofreader markups. For example, set the search text to [I (case insensitive, not whole word, not regex, start at beginning). Click Search or press Enter repeatedly to step through all [Illustration: markups in sequence. Use [F to step through all footnotes, [S for all sidenotes.
Set the search text to \[[^FIS] (literal left-bracket followed by the class of neither-F-nor-I-nor-S; case-insensitive, not whole-word, regex) and step through all left-bracket markups that are not notes or illustrations. This would include proofer notes marked with [* and transliterations, as well as most footnote anchors.
In a similar way you can set the search text to </?i> (either "<i>" or "</i>"; case-insensitive, not whole word, regex) and step through all italic markups. You could use </?[bi]> to step through all bold and italic markups. A search for *\s+* (asterisk, one or more whitespaces, asterisk) steps through thought breaks.