# XMLmind XML Editor - Online Help

## 4. Search tool

Procedure for performing a text search:

1. Type text to be searched in Search field or choose it from the menu of the combobox.

2. Change the search options as needed (see below).

3. Type Enter in the Search field or click on the Start button.

4. During the search session

   - click Skip on to skip found text,

   - OR click on Skip Element to skip the element containing the found text.

5. The search session can be stopped by

   - clicking on Stop,

   - OR typing Esc (this also gives back the keyboard focus to the document view),

   - OR by simply clicking anywhere in the document view.

Procedure for performing a text search/replace:

1. Type text to be searched in Search field or choose it from combo box menu.

2. Check the Replace toggle

3. Type replacement text in Replace field or choose it from combo box menu.

4. Change the search options as needed (see below).

5. Type Enter in the Search or Replace fields or click on the Start button.

6. During the search/replace session

   - click Skip on to skip found text,

   - OR click on Skip Element to skip the element containing the found text.

   - OR click Replace on to replace found text.

   - OR click Replace All on to replace all occurrences of searched text.

7. The search/replace session can be stopped by

   - clicking on Stop,

   - OR typing Esc (this also gives the keyboard focus back to the document view),

   - OR by simply clicking anywhere in the document view.

Search options:

Ignore case

  The search is case-insensitive. Example: "`foo`" matches both "`foo`" and "`Foo`".

  ### Tip

  When "Ignore case" has been checked, "Regular expression" has not been checked and both the searched string and the replacement string contain only lower-case letters or the hyphen character ('`-`'), the replacement string actually used is capitalized exactly like the found string it will replace.

  Example: if you specify "`editor`" as the search string and "`modeller`" as the replacement string, the Search tool will replace "`editor`" by "`modeller`", "`Editor`" by "`Modeller`" and "`EDITOR`" by "`MODELLER`".

  Counterexample: if you specify "`IBM`" as the search string and "`Lenovo`" as the replacement string, the Search tool will replace "`IBM`", "`Ibm`" and "`ibm`" by "`Lenovo`".

Whole word

  The found string must be a word, that is, the found string must be surrounded by white spaces. Example: "`foo`" matches "`foo`" but not "`foobar`".

Regular expression

  The searched string must be a valid regular expression. A regular expression is specified in a syntax similar to that used by Perl. See also http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html.

  In such case, `$1`, `$2`, ..., `$9` may be used in the replacement string to refer to the substrings matching the parenthesized groups of the regular expression.

  `$0` is replaced by the string matching the regular expression in its entirety. "`$$`" may be used to quote character '`$`'.

  Examples:

  - "`f(o+)`" matching "foo", replaced by "`g$1`", gives "`goo`".

  - "`f(o+)`" matching "`foo`", replaced by "`$0bar`", gives "`foobar`".

  - "`f(o+)`" matching "`foo`", replaced by "`g$$1`", gives "`g$1`".

Smart text boundaries

  Searching string "`Hello world!`" in an XML document is not as obvious as it seems: for example, is "`Hello world!`" with word "`Hello`" contained in an emphasis element followed by text node " `world!`" supposed to be found by XXE?

  - If this toggle is checked, the answer is yes. "`Hello world!`" is found within "`<em>Hello</em> world!`" but not within "`<p>Hello </p><p>world!</p>`".

    This mode uses the grammar constraining current document to recognize logically contiguous text across different types of elements.

  - If this toggle is not checked, the answer is no. Each text node is separated from other text nodes whatever the type of the element containing it.

Direction
  Up

    Search from the current caret position to the beginning of the document.

  Down

    Search from the current caret position to the end of the document.

Wrap search

  Restart the search from the beginning of the document when the end of the document has been reached. (If Direction is Down, restart the search from the end of the document when the beginning of the document has been reached.)