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.
eeFindReplaceQuiet Does not display a message on the status bar if no string is found.
eeFindReplaceOnlyWord Matches only whole words.
eeFindReplaceRegExp Uses a regular expression for the searched string. Cannot be combined with eeFindReplaceEscSeq.
eeReplaceSelOnly Replaces only in the selection.
eeReplaceAll Replaces all at once.
eeFindReplaceOpenDoc Searches all open documents in the same frame window.

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.

Send feedback on this topic to Emurasoft

Copyright © 2003-2008 by Emurasoft, Inc.