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

Find Method

Searches for the specified string.


nFound = document.selection.Find( strFind, nFlags[, nExFlags] );


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



Specifies a string to search for.


Specifies a combination of the following values:

eeFindAround Moves to the start of the document when reaches the end of the document.
eeFindBookmark Sets bookmarks on lines where the string is matched.
eeFindCount Counts the occurrences of the matched string.
eeFindExtract Extracts matched lines to a new document.
eeFindNext Searches downward from the cursor position.
eeFindMatchDotNL The regular expression "." can match new lines characters.
eeFindPrevious Searches upward from the cursor position.
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 Searches only in the selection.
eeFindSaveHistory Saves the searched string for repeated search.
eeFindSelectAll Selects all matched strings.


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 1 if the searched string is found, or 0 if not found. However, if the eeFindCount, eeFindBookmark, eeFindSelectAll, eeFindExtract flag is specified, the return value is the number of the occurrences of the matched string in the document.


Supported in EmEditor Professional Version 4.00 or later.

Copyright 2003-2016 by Emurasoft, Inc.