Show/Hide Toolbars

EmEditor Help

Navigation: EmEditor Help > Macro Reference > Selection Object > Methods

EmEditor Macro Reference: Replace Method

Scroll Prev Top Next More
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[,nExFlags] );

[VBScript]

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

Parameters

strFind

Specifies a string to search for.

strReplace

Specifies a string to replace with.

nFlags

Specifies a combination of the following values:

eeFindMatchDotNL

The regular expression "." can match new lines characters.

eeFindReplaceCase

Matches cases.

eeFindReplaceEmbeddedNL

Matches embedded newlines in CSV documents and does not match other newlines.

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.

eeFindReplaceSelOnly

Replaces only in the selection.

eeFindSaveHistory

Saves the searched string for repeated search.

eeReplaceAll

Replaces all at once.

eeReplaceSelOnly

Replaces only in the selection. (same as eeFindReplaceSelOnly)

nExFlags

Specifies a combination of the following values. However, only one of eeExFindRegexBoost and eeExFindRegexOnigmo can be specified. If none of these two is specified, the default regular expression engine is used.

eeExFindRegexBoost

Uses Boost.Regex as the regular expression engine.

eeExFindRegexOnigmo

Uses Onigmo as the regular expression engine.

eeExFindSeparateCRLF

Treats CR and LF separately.

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-2016 by Emurasoft, Inc.