73. replaceText
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 73. replaceText

Parameter syntax:

    [ '[' 'i'? 'w'? 'r'? 's'? 'b'? 'd'? 'a'?']' S ]?
    [ searched_text replacement_text ]?

Searches specified text and, if found, replace it by the other specified text.

If searched and replacement strings are not specified, this command displays a dialog box allowing to specify such strings as well as any of the options.

Searched and replacement strings, if specified, must be quoted if they contain white space.

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.

d (start at the beginning of the Document)

  Start at the beginning of the document rather than from caret position.

a (replace All)

  Replace all occurrences of the searched string rather then the first found one.

Examples:

    replaceText
    replaceText [wi]
    replaceText "XMLmind XML Editor" 'XXE'
    replaceText [r] X(\w+)d x$1d
    replaceText [da] foo bar

See also search.

Prev | Up | Next
72. replace | Home | 74. resizeImage