EmEditor Home - EmEditor Help - EmEditor Macro Reference - Selection Object

Replace Method

Replaces a string in the document.

[JavaScript]

nFound = document.selection.Replace( strFind, strReplace, nFlags );

[VBScript]

nFound = document.selection.Replace( strFind, strReplace, nFlags )

Parameters

strFind

Specifies a string to search for.

strReplace

Specifies a string to replace with.

nFlags

Specifies a combination of the following values:

eeFindReplaceCase Matches cases.
eeFindReplaceEscSeq Uses escape sequences. Cannot be combined with eeFindReplaceRegExp.
eeFindReplaceOnlyWord Matches only whole words.
eeFindReplaceOpenDoc Searches all open documents in the same frame window.
eeFindReplaceQuiet Does not display a message on the status bar if no string is found.
eeFindReplaceRegExp Uses a regular expression for the searched string. Cannot be combined with eeFindReplaceEscSeq.
eeFindSaveHistory Saves the searched string for repeated search.
eeReplaceAll Replaces all at once.
eeReplaceSelOnly Replaces only in the selection.

Return Values

Returns the number of replaced strings if eeReplaceAll is specified. Otherwise, returns 1 if found, or 0 if not.

Version

Supported on EmEditor Professional Version 4.00 or later.

Copyright 2003-2014 by Emurasoft, Inc.