S T R U C T O R I Z E R - User Guide
Features > Find & Replace

If you have to deal with a significant number of diagrams, powerful editing capabilities get essential. You may want to search for diagrams and elements containing certain substrings and to perform consistent changes (e.g. variable renaming) even throughout several diagrams.

The Find & Replace dialog offers a variety of helpful selection and modification opportunities in various combinations:

Find & Replace dialog

Activation

There are several ways to open the File & Replace dialog:

  • by pressing the speed button binoculars in the toolbar;
  • by entering the accelerator key combination <Ctrl><F>;
  • via the Edit menu:
    Edit menu version 3.27 with F & R selected

Find and Replace Patterns

At the window top you enter your textual search pattern, either interpreted as plain substring or as regular expression (depending on whether checkbox "Regular expressions" is selected).

Beneath the search pattern you may enter a replacing string or pattern if you intend to substitute one or more of the found substrings. If the Regular expressions checkbox is selected then the replacement may contain placeholders like $1, $2 etc. which refer to the content of the first, second and so on group of the regular expression match. (A group in a regular expression is a sub-pattern in parentheses, like ([0-9][0-9]) in the screenshot above, which would mean $1 to be 00, 02, 04, respectively, for the first, the second, and the third match).

The Find & Replace dialog keeps a history of depth 10 for each of the two pattern fields, which is available via the respective pulldown button.

Mode settings (left-hand side)

Here you may specify the search direction and how the patterns are to be interpreted.

Direction "down" means to traverse the search results from top to bottom and the matches within a single text in forward direction. Direction "up" is the opposite (bottom to top, from right to left).

The checkbox "Regular expressions" specifies - if selected - that the patterns be interpreted as regular expressions with extactly the syntax accepted by Java class java.util.regex.Pattern. Since a complete description would exceed the scope of this user guide, just some examples:

PatternMatchesExamples
b.y All three-character substrings starting with b and ending with y bay, boy, buy
b.?y Substrings with at most one character between b and y by, buy, b2y
b[a-z]*y Substrings with any number of lower-case letters between b and y by, bay, buoy, baby, belly, balcony
b[a-z]*?y Substrings with minimum number of lower-case letters between b and y the ones before except baby (where by is the smaller match)

The checkboxes "Case-sensitive" and "Whole word" are only selectible if "Regular expressions" is unchecked. Regular expressions may specify themselves whether case matters or how a substring be surrounded in order to match, though with some effort - in order to match the word "result" case-independently and as isolated word, you might write the following regular expression:

(^|\W)[Rr][Ee][Ss][Uu][Ll][Tt](\W|$)

In plain-string mode, case does not matter by default, and the pattern may be any substring, such that a search string BY would be found within Babylon.
By selecting any of the checkboxes "Case-sensitive" and "Whole word", however, the above case would no longer be a match.

Scope settings (left-hand side)

You may choose the search scope among

  • Opened diagrams = all diagrams currently held in Structorizer and Arranger,
  • Current diagram = just the current diagram in Structorizer (Arranger not searched), and
  • Current selection = just the currently selected sequence of elements in the current diagram, including substructure.

Until version 3.29-10 the result presentation and navigation in the central view of the dialog differed among the multi-diagram scope ("Opened diagrams") and the other two options (single-diagram), see "Result view" below. From version 3.29-11 on the result presentation will be unified.

If you opted for all opened diagrams then you may restrict the search to certain diagram types (i.e. any subset of them).

Then you may specify whether the element texts and/or the element comments are to be involved in the search. (To exclude both doesn't make sense, of course.)

Element types (right-hand side)

You may limit the search to any subset of element types, e.g. to exclude Call elements from search. The All and None button are to facilitate selecting or unchecking all element types at once.

Independently of the element type choice, you may or may not include disabled elements.

Result view (central)

When you have specified all search criteria according to the opportunities above, pressing the "Find" button will start the search.

The central view will show the tree (or "forest") of all found elements in the diagrams according to the scope setting. The diagrams containing elements with matches form the roots, the found elements are the subnodes (leaves) of their respective parent diagram. All elements with matches in texts or comments appear at the same level, no matter how deep they were structurally nested. If you don't see elements below a diagram root then just click on the respective root in order to expand the subtree. If the diagram header element itself holds a match then it will also be shown at the element level. In forward mode, the first matching element (in the first presented root) will already be selected and its text and comment appear in the contents text areas at the dialog bottom. If there are several matches within the enabled text areas then all but one are highlighted in yellow, the very current match within the text has orange background (see figure above).

The further navigation depends on whether checkbox "Element-wise" (in the lower left corner next to the buttons) is selected or not: If not then the next click on "Find" will move the orange spot to the next match within the text of the same element, if checked, however, the presentation skips to the next element from the result list ("fast" mode).

You may change navigation direction by switching the radio buttons "down" and "up", thus going back to previous matches.

While you traverse through the elements, Structorizer will simultaneously scroll through the current diagram and highlight the current element if the element belongs to the diagram in the work area. While you traverse elements of other diagrams in the result tree, Arranger will scroll to the respective diagram in its arrangement.

Versions before 3.29-11: If the scope was not "Opened diagrams" but either "Current diagram" or "Current selection" then the search results were not presented at once in the tree but traversed incrementally. You'll see only the current element as node and whether there is another match before and therafter:

Find & Replace dialog in current diagram mode

In the screenshot above, scope "Current diagram" was chosen, and the result view indicates that the currently inspected instruction element has possibly matching predecessors (by the pseudo-node with the ellipse above) but no potential successors (otherwise there would be another pseudo-node below it). So you had a very limited overview, although the current diagram in the Structorizer work area synchronously scrolls to the current search result and highlights it, while you navigate up / down with "Find" in the Find & Replace dialog.

Buttons

The Find button starts search (if result view was empty or exhausted) or moves the spot to the next/previous match within the text of the current element ("Element-wise" off) or to the next node of the search result ("Element-wise" on).

Button Replace/Find will replace the currently focussed match and then move to the next match the way the Find button would do. Be aware that doing the replace action with empty replace pattern field will delete the matching substring.

Button Replace just replaces the spotted match without moving the spot afterwards.

Button Replace All will blindly replace all remaining matches from the currently selected match on towards the end of the search result set in the specified navigation direction (down/up). So it doesn't always really mean "all".

Every single replacement is undoable (and redoable) in reverse order, but only from the respective diagram, which must be summoned to the Structorizer window. The undo / redo action or any other editing in the diagram will wipe the result tree in the Find & Replace window. So does any diagram addition or removal in the Arranger if scope "Opened diagrams" is selected.

The Close button will simply hide the Find & Replace dialog, all settings will be maintained and will still be present on reopening the dialog. Most criteria and the pattern histories will even be saved in the structorizer.ini file on ending the session such taht they will be restored in the next Structorizer session.

Mnemonics

The four main buttons and several other mode-relevant controls are associated with mnemonic keys, such that pressing <Alt>+mnemonic has the same effect as clicking the respective control. Version 3.29-11, however, modified some of the mnemonics (particularly that of the "Down" radio button) and equipped more controls with mnemonics. The underscores (becoming visible on holding the <Alt> key down) in the screenshot below show which mnemonics are configured for the English locale (may differ slightly with other locales) from version 3.29-11 on:

Find & Replace dialog with menomics