Vizard 8 » The Vizard IDE » Searching and navigation » Find and Replace
8.0

Find and Replace

Use Vizard's find and replace tools to search for phrases within documents and simplify editing. They can be accessed through the Edit drop down menu or through keyboard shortcuts:

Keyboard combination

Description

Ctrl + F

Open Find dialog

Ctrl + H

Open Find and Replace dialog

Ctrl + Shift + F

Open Find in Files dialog

F3

Go to next find result

Alt + F3 Go to next find result using current selection as search string

Shift + F3

Go to previous find result

Ctrl + F3

Go to next Find in Files result

Ctrl + Shift + F3

Go to previous Find in Files result

Alt + D

Activate Quick Search toolbar

Regular expressions

For more advanced searches use the Regular expression option. The search below will find all occurrences of hat and cat in the document:

The following table lists the special characters that will be interpreted when using this option:

Character

Description

Example

.

Matches any character

ca. will find  can, cat, and cam etc.

*

Matches 0 or more times.

Sa.*m finds Sm, Sam, Saam, Saaam etc.

+

Matches 1 or more times.

Sa.+m finds Sam, Saam, Saaam etc.

? Matches 0 or 1 times.  

[...]

Indicates a set of characters

[abc] finds characters a, b or c. Ranges can also be used. [a-z] will find any lower case character.

[^...]

The compliment of the characters in a set

[^A-Za-z] finds any non-alphabet characters.

\<

Matches the start of a word

\<m will find all the m characters that appear at the start of a word.

\>

Matches the end of a word

m\> will find all the m characters that appear at the end of a word.

\d Matches decimal digit (0-9). word\d will find word1 and word2, but not words.
\D Matches any character except a decimal digit. word\D will find words, but not word1 and word2.
\w Matches any alphanumeric or underscore character. my\w+ will find my_word but not my-word.
\W Matches any character except alphanumeric and underscore. my\Wword will find my word, but not my_word.
\s Matches any whitespace character. my\sword will find my word, but not my-word.
\S Matches any character except whitespace. my\Sword will find my-word, but not my word.

\(

Marks the start of a region for tagging a match.

See example below

\)

Marks the end of a region for tagging a match.

See example below

\n

Where n is 1 through 9 refers to the first through ninth tagged region when replacing

See example below

\x

Allows you to use a character x that would otherwise have a special meaning

\[ would be interpreted as [ and not as the start of a character set.

^

Matches the start of a line (unless used inside a set, see above)

^viz finds all lines that begin with viz.

$

Matches the end of a line

viz$ finds all lines that end with viz.

Example

 

The following illustrates a situation where a regular expression could be used with a find and replace operation:

 

Let's say there are a number of constants defined:

VAR_1 = 1
VAR_2 = 2
VAR_3 = 3
VAR_4 = 4

Now assume you want to append _STR to the name of the constants and change the value to a string type. You can select all the constants and perform a Regular Expression find and replace on the selected text using the following find/replace values:

 

find: \(.+\) = \(.+\)

replace: \1_STR = str(\2)

 

The \1 in the replace value is referring to whatever was found in the first set of special parentheses in the find value. The \2 refers to the found result in the second set, and so on. Performing this find/replace should result in the following:

VAR_1_STR = str(1)
VAR_2_STR = str(2)
VAR_3_STR = str(3)
VAR_4_STR = str(4)

Searching within multiple files

To search for a phrase within multiple files use the Find in Files tool:

Once the search is complete a list of results will be displayed in the Find Results pane:

By double clicking on a result, the containing document will be opened in the editor at the location of the matching phrase.

Quick Search

The Quick Search toolbar provides a quick way to search within all open scripts or the active script. Use the Alt + D keyboard shortcut to place the cursor inside the toolbar and begin typing your search phrase. As you type, the Find Results pane will be populated with the latest results.

Navigation history

All find operations affect the navigation history as described in the Navigate backward/forward page.