76. search
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 76. search

Parameter syntax:

    [ '[' 'i'? 'w'? 'r'? 's'? 'b'? 'x'? ']' S ]?
    [ searched_text ]?

Searches specified text from caret position to end of document, or if the `b` (Backwards) option has been specified, from caret position to beginning of document.

If searched text is not specified, this command displays a dialog box allowing to specify such text as well as any of the options.

Searched string, if specified, does not need to be quoted, even if it includes white space. However, beginning and trailing whitespace is removed from searched string before the command is executed. Therefore, the only way to search text starting and/or ending with whitespace is to quote (using single quotes or double quotes) the searched string.

Options (order of option letters is not important):

i (Ignore case)

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

w (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`".

r (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.

s (Smart mode)

  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 option is selected, 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 option is not selected, the answer is no. Each text node is separated from other text nodes whatever the type of the element containing it.

b (Backwards)

  Search backwards.

x (eXtend text selection)

  Extend text selection, if any, in order to include found text.

Examples:

    search
    search [xwi]
    search XMLmind XML Editor
    search [r] X\w+d
    search "XMLmind "
    search ' XML'

See also replaceText, searchReplace and xpathSearch.

Prev | Up | Next
75. run | Home | 77. searchReplace