Searching in Text View

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Common Tasks > Working with Mappings >

Searching in Text View

The text in the Output pane, the XQuery pane, as well as the XSLT pane can be searched using an extensive set of options and visual aids.

 

To start a search , press Ctrl+F (or select the menu command Edit | Find). You can then search in the entire document or within a text selection for a search term that you enter in the dialog.

 

Enter a string to find, or use the combo box to select a string from one of the last 10 strings.
When you enter or select a string to find, all matches are highlighted and the positions of the matches are indicated by beige markers in the scroll bar.
The currently selected match has a different highlight color than the other matches, and its position is indicated in the scroll bar by the dark blue cursor-marker.
The total number of matches is listed below the search term field, together with the index position of the currently selected match. For example, 2 of 4 indicates that the second of four matches is currently selected.
You can move from one match to the next, in both directions, by selecting the Previous _ic_find_prev (Shift+F3) and Next _ic_find_next (F3) buttons at bottom right.

inc-dlgFind

To close the Find dialog, click the Close _ic_find_close button at top right, or press Esc.

 

Note the following points:

 

The Find dialog is modeless. This means that it can remain open while you continue to use Text View.
If text is selected prior to opening the dialog box, then the selected text is automatically inserted into the search term field.
To search within a selection, do the following: (i) Mark the selection; (ii) Toggle on the Find in Selection _ic_find_in_selection option to lock the selection; (iii) Enter the search term. To search within another selection, unlock the current selection by toggling off the Find in Selection _ic_find_in_selection option, then make the new selection and toggle on the Find in Selection _ic_find_in_selection option.
After the Find dialog is closed, you can repeat the current search by pressing F3 for a forward search, or Shift+F3 for a backward search. The Find dialog will appear again in this case.

 

Find options

Find criteria can be specified via buttons located below the search term field. When an option is toggled on, its button color changes to blue. You can select from the following options:

 

Option

Icon

Description

Match case

_ic_find_match_case

Performs a case-sensitive search when toggled on ("Address" is not the same as "address").

Match whole word

_ic_find_match_word

Only the exact words in the text will be matched. For example, for the input string fit, with Match whole word toggled on, only the word fit will match the search string; the fit in fitness, for example, will not.

Regular expression

_ic_find_regex

If toggled on, the search term will be read as a regular expression. See "Using regular expressions" below.

Find anchor

_ic_find_anchor

When a search term is entered, the matches in the document are highlighted and one of these matches will be marked as the current selection. The Find anchor toggle determines whether that first current selection is made relative to the cursor position or not. If Find anchor is toggled on, then the first currently selected match will be the next match from the current cursor location. If Find anchor is toggled off, then the first currently selected match will be the first match in the document, starting from the top.

Find in selection

_ic_find_in_selection

When toggled on, locks the current text selection and restricts the search to the selection. Otherwise, the entire document is searched. Before selecting a new range of text, unlock the current selection by toggling off the Find in Selection option.

 

Using regular expressions

You can use regular expressions (regex) to find a text string. To do this, first, switch the Regular expression _ic_find_regex option on. This specifies that the text in the search term field is to be evaluated as a regular expression. Next, enter the regular expression in the search term field. For help with building a regular expression, click the Regular Expression Builder _ic_find_regex_builder button, which is located to the right of the search term field. Click an item in the Builder to enter the corresponding regex metacharacter/s in the search term field. The screenshot below shows a simple regular expression to find email addresses.

inc-findRegex

The following custom set of regular expression metacharacters are supported when finding and replacing text.

 

.

Matches any character. This is a placeholder for a single character.

(abc)

The ( and ) metacharacters mark the start and end of a tagged expression. Tagged expressions may be useful when you need to tag ("remember") a matched region for the purpose of referring to it later (back-reference). Up to nine sub-expressions can be tagged (and then back-referenced later).

 

For example, (the) \1 matches the string the the. This expression can be literally explained as follows: match the string "the" (and remember it as a tagged region), followed by a space character, followed by a back-reference to the tagged region matched previously.

\n

Where n is 1 through 9 , n refers to the first through ninth tagged region (see above).

\<

Matches the start of a word.

\>

Matches the end of a word.

\

Escapes the character following the backslash. In other words, the expression \x allows you to use the character x literally. For example, \[ would be interpreted as [ and not as the start of a character set.

[...]

Matches any characters in this set. For example, [abc] matches any of the characters a, b or c. You can also use ranges: for example [a-z] for any lower case character.

[^...]

Matches any characters not in this set. For example, [^A-Za-z] matches any character except an alphabetic character.

^

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

$

Matches the end of a line. For example, A+$ matches one or more A's at end of line.

*

Matches zero or more occurrences of the preceding expression. For example, Sa*m matches Sm, Sam, Saam, Saaam and so on.

+

Matches one or more occurrences of the preceding expression. For example, Sa+m matches Sam, Saam, Saaam and so on.

 

Finding special characters

You can search for any the following special characters within text, provided that the Regular expression option _ic_find_regex is enabled:

\t (Tab)
\r (Carriage Return)
\n (New line)
\\ (Backslash)

For example, to find a tab character, press Ctrl + F, select the _ic_find_regex option, and then enter \t in the Find dialog box.


© 2019 Altova GmbH