GREP_INFO_EX

Used by Editor_FindInFiles macro, Editor_ReplaceInFiles macro ( EE_FIND_IN_FILESW message, EE_REPLACE_IN_FILESW message).

typedef struct _GREP_INFOW {
	size_t cbSize;
	UINT nCP;
	UINT64 nFlags;
	LPCWSTR pszFind;
	LPCWSTR pszReplace;
	LPCWSTR pszPath;
	LPCWSTR pszBackupPath;
	LPCWSTR pszFilesToIgnore;
	UINT nLimit;
	UINT64 nTotalCount;
	HRESULT hr;
} GREP_INFOW;

Fields

cbSize

Specifies size_of(GREP_INFO_EX).

nCP

Specifies a code page by which a file is opened.

CODEPAGE_ANSI

Normal ANSI

CODEPAGE_UNICODE

Unicode little endian

CODEPAGE_UNICODE_BIGENDIAN

Unicode big endian

CODEPAGE_UTF8

UTF-8

CODEPAGE_UTF7

UTF-7

CODEPAGE_932

Japanese Shift JIS

CODEPAGE_JIS

Japanese JIS

CODEPAGE_EUC

Japanese EUC

CODEPAGE_AUTO_SJIS_JIS

Converts from Japanese Shift JIS and JIS.

CODEPAGE_AUTO_SJIS_JIS_EUC

Converts form Japanese Shift JIS、JIS、EUC.

Others

All code pages you can used by system.

CODEPAGE_DETECT_UNICODE

Detects Unicode. Can be combined with another value.

CODEPAGE_DETECT_UTF8

Detects UTF-8. Can be combined with another value.

CODEPAGE_DETECT_CHARSET

Detects HTML/XML Charset. Can be combined with another value.

CODEPAGE_DETECT_ALL

Detects all code pages. Can be combined with another value.

nFlags

Specifies a combination of the following values.

FLAG_FIND_CASE

Matches cases.

FLAG_FIND_COUNT_FREQUENCY

Creates a table of frequent strings from the results. Must combine with FLAG_FIND_OUTPUT_DISPLAY.

FLAG_FIND_ESCAPE

Uses escape sequences. Cannot be combined with FLAG_FIND_REG_EXP.

FLAG_FIND_FUZZY

Uses fuzzy matching.

FLAG_FIND_IGNORE_FILES

Ignores the files or folders specified by pszFilesToIgnore.

FLAG_FIND_ONLY_WORD

Searches only words.

FLAG_FIND_RECURSIVE

Searches in subfolders of the specified path.

FLAG_FIND_REG_EXP

Uses a regular expression. Cannot be combined with FLAG_FIND_ESCAPE.

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_OPEN_DIRECT

Directly opens the document that includes the specified string. Cannot combine with FLAG_FIND_OPEN_FILTER or FLAG_FIND_OUTPUT.

FLAG_FIND_OPEN_FILTER

Directly opens the document that includes the specified string, and set the specified string as the filter. Cannot combine with FLAG_FIND_OPEN_DIRECT or FLAG_FIND_OUTPUT.

FLAG_FIND_OUTPUT

Displays the Find in Files results as a list in the Output Bar. Cannot combine with FLAG_FIND_OPEN_DIRECT or FLAG_FIND_OPEN_FILTER.

FLAG_FIND_OUTPUT_ENCODING

Appends encoding names to file names.

FLAG_FIND_SEPARATE_CRLF

Treats CR and LF separately.

FLAG_REPLACE_BACKUP

Saves the backups. Cannot be combined with FLAG_REPLACE_KEEP_OPEN.

FLAG_REPLACE_KEEP_OPEN

Keeps the modified files open. Cannot combine with eeReplaceBackup. Cannot be combined with FLAG_REPLACE_BACKUP.

Additionally, you may specify one of the following values.

FLAG_FIND_FILE_AND_MATCHED

File names and matched strings will be displayed.

FLAG_FIND_FILE_LINE_AND_MATCHED

File names, line numbers and matched strings will be displayed.

FLAG_FIND_FILENAMES_ONLY

Only file names will be displayed and the whole lines containing the searched string will not be displayed as results.

FLAG_FIND_LINE_ONLY

Only the whole lines containing the searched string will be displayed as results.

FLAG_FIND_MATCHED_ONLY

Only the matched strings will be displayed as results.

pszFind

Specifies a string to search for.

pszReplace

When replacing in files, specifies a string to replace with.

pszPath

Specifies a path to search from. It can include wild cards such as * and ?.

pszBackupPath

When replacing in files, specifies the backup folder, if nFlags includes FLAG_REPLACE_BACKUP.

pszFilesToIgnore

If nFlags includes FLAG_FIND_IGNORE_FILES, specifies the file or folder names to ignore. It can include wild cards such as * and ?. To specify multiple files, use semicolons (;) to separate them.

nLimit

EmEditor stops searching files when the number of matches reaches this number. If 0 is specified, EmEditor does not stop searching files.

nTotalCount

This field will receive the total number of the occurrences of the matched string in all the searched files on return. If this is not used for replacing in files, the return value is the total number of lines containing matched strings in all the searched files.

hr

This field will be filled with the result value where the negative value indicates an error. Error values include the following values.

E_WRONG_NUM_FORMAT

An incorrect format of a number/IP address range was detected.

E_REGEX_UNKNOWN

An unknown error occurred in the regular expression engine.

Version

Supported on EmEditor Professional Version 15.7 or later.