Editor_BatchFindReplace

Searches or replaces multiple strings. You can use this inline function or explicitly send the EE_FIND_REPLACE message.

HRESULT Editor_BatchFindReplace( HWND hwnd, FIND_REPLACE_INFO* pBatchArray, UINT nBatchCount, UINT64 nBatchFlags, UINT64* pnTotalCount );

Parameters

hwnd

Specifies the window handle of the view or frame of EmEditor.

pBatchArray

Pointer to the array of FIND_REPLACE_INFO structure.

nBatchCount

Specifies the number of FIND_REPLACE_INFO structures specified in pBatchArray parameter.

nBatchFlags

[in] Specifies a combination of the following values.

Value

Meaning

FLAG_FIND_AROUND

Moves to start/end of the text.

FLAG_FIND_BOL

The regular expression ‘^’ can match the beginning of the selection.

FLAG_FIND_BOOKMARK

Sets bookmarks on lines where the string is matched.

FLAG_FIND_COUNT

Counts the occurrences of the matched string.

FLAG_FIND_COUNT_FREQUENCY

Creates a table of frequent strings from the Extract results. Must combine with FLAG_FIND_EXTRACT and FLAG_FIND_OUTPUT_DISPLAY. Window Tabs must be enabled.

FLAG_FIND_EMBEDDED_NL

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

FLAG_FIND_EOL

The regular expression ‘$’ can match the end of the selection.

FLAG_FIND_EXTRACT

Extracts matched lines to a new document.

FLAG_FIND_FUZZY

Uses fuzzy matching.

FLAG_FIND_LOOKAROUND

Looks around during selection only regular-expression searches.

FLAG_FIND_NEXT

Searches the string downward from the cursor position. If this flag is not set, searches the string upward.

FLAG_FIND_NO_PROMPT

Suppresses displaying a dialog box even if no string is found.

FLAG_FIND_OPEN_DOC

Searches all open documents in the same frame window.

FLAG_FIND_OUTPUT

Displays the Extract results as a list in the Output Bar. Must combine with FLAG_FIND_EXTRACT.

FLAG_FIND_REGEX_BOOST

Uses Boost.Regex as the regular expression engine.

FLAG_FIND_REGEX_ONIGMO

Uses Onigmo as the regular expression engine, using the Ruby syntax.

FLAG_FIND_REGEX_ONIGMO_PERL

Uses Onigmo as the regular expression engine, using the Perl syntax.

FLAG_FIND_SAVE_HISTORY

Saves the searched string for repeated search.

FLAG_FIND_SEPARATE_CRLF

Treats CR and LF separately.

FLAG_FIND_SEL_ONLY

Searches only in the selection.

FLAG_REPLACE_ALL

Replaces all occurrences.

FLAG_REPLACE_SEL_ONLY

Replaces only in the selection when specified with FLAG_REPLACE_ALL.

pnTotalCount

[out] Specifies a pointer to the variable that receives the number of occurrences when nBatchFlags includes FLAG_FIND_COUNT, FLAG_FIND_BOOKMARK, FLAG_FIND_SELECT_ALL, FLAG_FIND_EXTRACT or FLAG_FIND_FILTER.

Return Values

Returns S_OK if the searched string is found, S_FALSE if not found. The return value is a negative value is an error occurs. The negative value includes E_ABORT if a user cancels the search, and E_FAIL if a fatal error occurs.

Version

Supported on Version 19.9 or later.