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

Find Method

Searches for the specified string.


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


nFound = document.selection.Find( strFind, nFlags )



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.
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.

Return Values

Returns 1 if the searched string is found, or 0 if not found. However, if the eeFindCount flag is specified, the return value is the number of the occurrences of the matched string in the document. Nevertheless, if the searched string is not found from the cursor position toward the specified direction, the return value is 0 even it the matched string is found in the rest of the document.


Supported in EmEditor Professional Version 4.00 or later.

Copyright 2003-2015 by Emurasoft, Inc.