שימוש במסננים


כשאתה משווה קבצים או תיקיות, אתה יכול להשתמש במסננים כדי לצמצם את היקף ההשוואה. זה יכול להיות שימושי כשאתה רוצה לפשט את תוצאת ההשוואה על ידי ביטול הבדלים שאינך מעוניין בהם. מסננים הם כללים המבוססים על ביטויים רגולריים. WinMerge משתמש במנוע הביטויים הרגולריים הפופולרי PCRE (ביטויים רגולריים תואמי Perl).

הפונקציה הבסיסית של סינון היא פשוטה: הערכת כל פריט שבדרך כלל יושווה (תיקייה, קובץ או שורה בתוך קובץ), ואם ביטוי המסנן תואם לפריט היעד, החל את המסנן. בהתאם לסוג המסנן, הפריט נכלל או לא נכלל בהשוואה.

ישנם מסנני WinMerge שונים עבור פעולות השוואת תיקיות והשוואת קבצים:

השוואת תיקיות: מסיכות קבצים ומסנני קבצים

You can specify files to include in a folder comparison by using simple file masks, or, for more complex filtering, by applying multiple rules specified in a file filter.

קבצים ותיקיות שמסוננים מוסתרים בתוצאה כברירת מחדל, וזה בדרך כלל מה שאתה רוצה. אתה יכול ללחוץ על תצוגההצג פריטים שדולגו כדי לבטל את ההסתרה של פריטים מסוננים, אך חלון השוואת התיקיות מציג רק מידע מינימלי עליהם. לדוגמה, אינך יכול לדעת אם קובץ שדולג הוא קובץ טקסט או בינארי.

The display file/folder filter is also available for folder compare operations. Unlike file filters, it does not affect the comparison result; it only controls which items are visible in the Folder Compare window. See סעיף 5, “Using the display file/folder filter”.

השוואות קבצים: מסנני שורות ומסנני החלפה

מסנני שורות מוחלים רק על פעולות השוואת קבצים. הם מאפשרים לך להתעלם מהבדלי שורה בודדים.

מסנני החלפה מוחלים רק על פעולות השוואת קבצים. הם מחליפים את המחרוזות בגוש ה-diff במחרוזות שצוינו, משווים אותן ומתעלמים מגוש ה-diff אם תוצאות ההחלפה תואמות. הם שימושיים להתעלמות ממספר רב של שינויים לא מעניינים.

The display line filter is also applied only to file compare operations. Unlike line filters, it does not affect the comparison result; it only controls which lines are visible in the File Compare window. See סעיף 4, “Using the display line filter”.

1. שימוש במסיכות קבצים

אתה יכול להשתמש במסיכות קבצים אחת או יותר שמציינות סיומות קבצים שיכללו בהשוואת תיקיות. כל שאר הקבצים מושמטים מהבחירה שלך.

1.1. הגדרה והחלה של מסיכות קבצים

הגדר והחל מסיכת קבצים בזמן שאתה מפעיל את פעולת השוואת התיקיות שלך:

  • אם אתה משתמש בתיבת הדו-שיח בחר קבצים או תיקיות, לאחר בחירת התיקיות 1 ו-2, הזן מסיכת קבצים אחת או יותר בשדה מסנן. המסכות מוחלות כשאתה מתחיל את פעולת השוואת התיקיות.

  • אם אתה משתמש בשורת הפקודה של WinMerge, השתמש בדגל -f כדי לציין מסיכות קבצים (ראה את הדוגמה בסעיף הבא).

1.2. תחביר ודוגמה של מסיכת קבצים

You can specify file masks and extended filters using this format:

        Filter1 of Group1;Filter2 ...|Filter1 of Group2;Filter2 ...|...
      
  • The | character separates filter groups and acts as a logical AND.

  • Filters within the same group are separated by ; and are interpreted with a logical OR.

  • A file is included only if it matches at least one filter in each group.

  • To include a literal | (pipe) character in a regular expression that is not enclosed in double quotes (such as in f: or f!: filters), use || instead.

    Example: f:(abc||def)\.txt$

  • Each filter (e.g., Filter1, Filter2) can be one of the following types:

    *.ext

    File mask by extension (e.g., *.txt)

    *.

    Files with no extension (e.g., README)

    !*.ext

    Exclude files matching the extension (Available since 2.16.19)

    folder\

    Target folders (must end with \) (Available since 2.16.19)

    !folder\

    Exclude matching folders (Available since 2.16.19)

    f: regexp

    Match file names using regular expressions (Available since 2.16.49)

    f!: regexp

    Exclude files matching regex (Available since 2.16.49)

    d: regexp

    Match folder names using regex (Available since 2.16.49)

    d!: regexp

    Exclude folders matching regex (Available since 2.16.49)

    fe: expr

    Filter expression for files (e.g. fe:Size < 1KB) (Available since 2.16.49)

    fe!: expr

    Filter expression to exclude files (Available since 2.16.49)

    de: expr

    Filter expression for folders (Available since 2.16.49)

    de!: expr

    Filter expression to exclude folders (Available since 2.16.49)

    pf: file filter name

    Apply a file filter by name (Available since 2.16.49)

דוגמה 1. מסיכת קבצים

בדוגמה זו של שורת הפקודה, פעולת השוואת התיקיות כוללת רק קבצים עם סיומות xml או txt. כל שאר הקבצים מושמטים:

WinMergeU c:\project\docs c:\temp /f *.xml;*.txt


דוגמה 2. Excluding folders (since version 2.16.19)

בדוגמה זו של שורת הפקודה, פעולת השוואת התיקיות אינה כוללת תיקיות .git ו-.vs:

WinMergeU c:\project\docs c:\temp /f !.git\;!.vs\


דוגמה 3. Filter expression (since version 2.16.49)

In this command-line example, the folder compare operation includes only files with cpp or h extensions and a file size less than 1KB:

WinMergeU c:\project\docs c:\temp /f "*.cpp;*.h|fe:Size < 1KB"


1.3. Filter Expression Syntax

WinMerge allows powerful filtering using expressions that operate on file metadata, contents, and comparison context. This section describes the supported attributes, operators, functions, data types, and evaluation rules.

1.3.1. Literals and Types

Supported literal types include:

  • Boolean: true, false

  • Null: none (represents a null or missing value)

  • Integer: 64-bit signed integers (e.g., 1024, or with units like 100KB, 7days)

  • Real (Double): Floating-point numbers with optional decimal or exponent (e.g., 3.14, .5, 1e6)

  • String: Enclosed in double quotes (e.g., "example")

  • Date/Time: Prefixed with d and enclosed in double quotes (e.g., d"2026-05-21 07:16:33", d"2026-05-21")

Internally, values may be of the following types: Boolean, Integer, Real, Timestamp, String, File Content, Array, or none.

1.3.2. Directives

Filter expressions support directives that control how the expression is evaluated. Directives are specified at the beginning of the expression, prefixed with @, and separated from the expression by whitespace.

1.3.2.1. Case Sensitivity Directives

By default, all string comparison operators (=, !=, <, <=, >, >=, contains, recontains, like, matches) are case-insensitive. You can control this behavior using the following directives:

@cs, @casesensitive

Enable case-sensitive comparison. With these directives, "ABC" and "abc" are considered different.

@ci, @caseinsensitive

Enable case-insensitive comparison (default behavior). With these directives, "ABC" and "abc" are considered identical.

דוגמה 4. Case Sensitivity Examples

@cs Name = "README.txt"           ## Case-sensitive: matches only "README.txt"
@ci Name = "readme.txt"           ## Case-insensitive: matches "README.txt", "readme.txt", "ReadMe.TXT", etc.
@casesensitive Extension = "TXT"  ## Case-sensitive: matches only files with ".TXT" extension
@caseinsensitive Content contains "error"  ## Case-insensitive: matches "Error", "ERROR", "error", etc.

1.3.2.2. Optimization Directives

By default, filter expressions are optimized to improve performance. You can control this behavior using the following directives:

@optimize, @opt

Enable filter expression optimization (default behavior). This may improve performance for complex expressions.

@nooptimize, @noopt

Disable filter expression optimization. This is useful for debugging or when optimization causes unexpected results.

דוגמה 5. Optimization Examples

@optimize Size > 10MB and Extension = "log"     ## Enable optimization (default)
@noopt Name matches "complex[0-9]+pattern"    ## Disable optimization for debugging
@nooptimize Content contains "special-case"   ## Disable optimization

1.3.2.3. Name Directive

The @name directive allows you to assign a descriptive name to a filter expression. This name is intended for use in error messages and logs to help identify which filter expression caused an issue.

@name="Filter Name", @name=FilterName

Assigns a name to the filter expression. If the name contains spaces or special characters, it must be enclosed in double quotes. Names without spaces can be specified without quotes.

The specified name will be used in error messages and diagnostic output to identify the filter. This is particularly useful when working with multiple complex filter expressions.

דוגמה 6. Name Directive Examples

@name="Large Image Files" Size > 10MB and Extension = "png"
@name=SmallTextFiles Size < 1KB and Extension = "txt"
@name="Modified Today" Date >= today()
@name="Test Filter" @cs Name like "test_*.cpp"

שים לב

The @name directive can be combined with other directives. When multiple directives are used, they should all appear at the beginning of the expression, separated by whitespace.

1.3.3. Attributes

Filter expressions support a variety of attributes referring to file metadata and content. Attribute names are case-insensitive. You can optionally specify which side of the comparison (Left, Right, or Middle) an attribute applies to by using a prefix.

1.3.3.1. Core Attributes
Exists

Returns true if the file exists, false otherwise

Name

File name

BaseName

Returns the filename without extension. For example, "document.txt" returns "document".

Extension

File extension

IsFolder

Returns true if the item is a folder/directory, false if it's a file.

Folder

Returns the relative path excluding the file name and base folder

RelPath

Returns the relative path from the comparison root directory, including both folder path and filename. For example, if comparing "C:\Project" and the file is at "C:\Project\src\main.cpp", RelPath returns "src\main.cpp".

FullPath

Returns the full path of the file

Size

File size

Date

Last modified timestamp

DateStr

Last modified date string in yyyy-MM-dd format

CreationTime

Creation date timestamp

Attributes

Returns the file attributes as an integer value

AttrStr

Returns file attribute string. Examples: "R" for Read-only, "H" for Hidden, "A" for Archive, "S" for System file.

1.3.3.2. File-only Attributes

The following attributes are available only for file comparison items. When used with folder items, the behavior is undefined.

Content

Content of the file. Returns a FileContent-type value. Only contains and recontains can be used with this type.

1.3.3.3. Folder-only Attributes

The following attributes are available only for folder comparison items. When used with file items, the behavior is undefined.

Files

Number of files directly contained in the folder.

RecursiveFiles

Number of files contained in the folder, including all subfolders.

Items

Number of items (files and subfolders) directly contained in the folder.

RecursiveItems

Number of items (files and subfolders) contained in the folder, including all subfolders.

TotalSize

Total size of all files directly contained in the folder, in bytes.

RecursiveTotalSize

Total size of all files contained in the folder, including all subfolders, in bytes.

1.3.3.4. Side-Specific Prefixes

Prefixes may be added to specify the comparison side:

  • Left: Applies to the file on the left side (e.g., LeftSize)

  • Right: Applies to the file on the right side (e.g., RightDate)

  • Middle: Applies to the middle file in 3-way comparison (e.g., MiddleName)

Attributes without a prefix (e.g., Size) return an array of values from all available sides (Left, Middle, Right).

1.3.3.5. Windows Property Attributes

These attributes provide access to Windows Property System values, such as metadata defined by the Windows Property System schema (e.g., System.Title, System.FileOwner, System.Image.HorizontalResolution).

Prop

Returns an array of property values (Left, Middle, Right) for the specified canonical property name. Example: prop("System.Title")

LeftProp

Property value of the left-side file. Example: leftprop("System.FileOwner")

MiddleProp

Property value of the middle file (in 3-way comparison).

RightProp

Property value of the right-side file.

1.3.3.6. Display Filters Only Attributes

The following attributes are designed for use in Display filters only (specified via e:, e!:, fe:, fe!:, de:, or de!: prefixes in the Filter field). They should not be used in file filter (.flt) include/exclude rules, as they require the comparison to be completed first and may lead to unexpected behavior.

Identical

Returns true if the comparison result indicates the items are identical, false otherwise. This is a global attribute (does not support side-specific prefixes). Example: Identical to show only identical files.

Different

Returns true if the comparison result indicates the items are different, false otherwise. This is a global attribute (does not support side-specific prefixes). Example: Different to show only different files.

Skipped

Returns true if the comparison was skipped due to an error or filter rule, false otherwise. This is a global attribute (does not support side-specific prefixes). Example: Skipped to show only skipped items.

Binary

Returns true if the file is detected as binary, false if it's text, or none if the file doesn't exist. This attribute supports side-specific prefixes (e.g., LeftBinary, RightBinary). Example: allof(Binary) to show files that are binary on all sides.

DifferentLeftMiddle

Returns true if the left and middle files are different in a 3-way comparison, false otherwise. Returns none in 2-way comparisons. This is a global attribute (does not support side-specific prefixes). Example: DifferentLeftMiddle and not DifferentMiddleRight to find files where only left differs from middle.

DifferentMiddleRight

Returns true if the middle and right files are different in a 3-way comparison, false otherwise. Returns none in 2-way comparisons. This is a global attribute (does not support side-specific prefixes). Example: DifferentMiddleRight to show files where middle and right differ.

DifferentLeftRight

In 3-way comparisons, returns true if the left and right files are different, false otherwise. In 2-way comparisons, returns true if both files exist and are different. This is a global attribute (does not support side-specific prefixes). Example: DifferentLeftRight to show files where left and right differ.

Differences

Returns the number of text differences in the file comparison. This attribute is only meaningful for text files that have been compared. This is a global attribute (does not support side-specific prefixes). Example: Differences > 0 to show files with differences, or Differences > 10 to show files with more than 10 differences.

IgnoredDiffs

Returns the number of ignored differences in the file comparison (differences filtered by line filters or whitespace settings). This attribute is only meaningful for text files that have been compared. This is a global attribute (does not support side-specific prefixes). Example: IgnoredDiffs > 0 to show files with ignored differences, or Differences = 0 and IgnoredDiffs > 0 to show files that are identical except for ignored differences.

Unpacker

Returns the name of the unpacker plugin used for the file comparison, or an empty string if no unpacker was used. This is a global attribute (does not support side-specific prefixes). Example: Unpacker = "CompareMSExcelFiles" to show files compared using the Excel unpacker, or Unpacker != "" to show all files where an unpacker was used.

Prediffer

Returns the name of the prediffer plugin used for the file comparison, or an empty string if no prediffer was used. This is a global attribute (does not support side-specific prefixes). Example: Prediffer = "IgnoreColumns" to show files compared using the IgnoreColumns prediffer, or Prediffer != "" to show all files where a prediffer was used.

EOL

Returns the end-of-line (EOL) style as an integer value. For files, returns the predominant EOL style; for lines, returns the EOL style of that specific line.

Values: 0 = None, 1 = LF (Unix), 2 = CR (Mac), 3 = CRLF (Windows), 4 = Mixed (multiple EOL styles in file)

EOLStr

Returns the end-of-line (EOL) style as a string. For files, returns the predominant EOL style; for lines, returns the EOL style of that specific line.

Values: "None", "LF", "CR", "CRLF", "Mixed"

Codepage

Returns the file's codepage (character encoding) as an integer value. This attribute supports side-specific prefixes (e.g., LeftCodepage, RightCodepage). Example: Codepage = 65001 to show UTF-8 files, or allof(Codepage = 65001) to show files that are UTF-8 on all sides.

HasBOM

Returns true if the file has a Byte Order Mark (BOM), false otherwise. This attribute supports side-specific prefixes (e.g., LeftHasBOM, RightHasBOM). Example: HasBOM to show files with BOM, or not HasBOM to show files without BOM.

1.3.3.7. Array Evaluation

Attributes without a side prefix (e.g., Size) return an array of values from all available sides (Left, Middle, Right). When applying an operator to such arrays, behavior differs depending on whether the comparison is with a scalar or another array.

1.3.3.7.1. Array vs Scalar

When comparing an array to a scalar, the operation is applied to each array element individually. This results in a boolean array. If any element in this boolean array is true, the overall expression evaluates to true. Otherwise, it evaluates to false.

דוגמה 7. דוגמה

[3, 5, 8] > 6 -> [false, false, true] -> true

1.3.3.7.2. Array vs Array

When comparing two arrays, the behavior depends on the operator:

  • For = and !=: The arrays must have the same length. The result is a single boolean value, not an array. = returns true only if all elements are equal. != returns true if any element differs.

  • For all other operators (e.g., >, <): the operation is applied element-wise, producing a boolean array. The final result of the expression is true if any element in the boolean array is true, and false if all elements are false.

דוגמה 8. Examples

[2, 4] = [2, 4] -> true
[2, 4] != [2, 5] -> true (because 4 != 5)
[3, 5, 8] > [6, 4, 2]
 -> [false, true, true]
 -> true (because at least one comparison is true)
              

1.3.3.7.3. Summary
  • Array vs scalar comparisons produce a boolean array. The overall expression result is true if at least one element is true.

  • Array vs array with = or != returns a single boolean value.

  • Array vs array with other operators produces a boolean array. The final result is true if any element is true.

1.3.4. Operators

By default, all string comparison operators (such as =, !=, <, <=, >, >=, like, matches, contains, and recontains) are case-insensitive. You can control this behavior using directives (see סעיף 1.3.2.1, “Case Sensitivity Directives”).

<, <=, >, >=

Numeric, timestamp, or string comparison

=

Equality comparison

!=

Inequality comparison

+, -, *, /, %

Arithmetic operators. + and - perform addition and subtraction. * and / perform multiplication and division. % is the modulo operator (remainder).

and, or, not

Logical operators

like

Wildcard string match

You can also use not like to perform the inverse match.

matches

Matches regular expressions

You can also use not matches to perform the inverse match.

contains

Checks if a string contains a substring

You can also use not contains to check for absence of the substring.

recontains

Checks if any substring matches a regular expression

You can also use not recontains to ensure no match exists.

1.3.5. Functions

Filter expressions support various functions for manipulating and analyzing data. Functions are organized by category for easier reference.

1.3.5.1. String Functions
strlen(source)

Returns the length of the string as an Integer. If source is a string array, the result is an integer array. Example: strlen(Name)

strCount(str, substr)

Counts how many times the substring substr appears in str. The search is case-insensitive by default (respects @cs/@ci directives). If str is an array, the result is an integer array with counts for each element. Overlapping matches are counted separately (e.g., strCount("aaaa", "aa") returns 2).

Examples:

  • strCount("hello hello world", "hello") returns 2

  • strCount("Test TEST test", "test") returns 3 (case-insensitive)

  • @cs strCount("Test TEST test", "test") returns 1 (case-sensitive)

  • le:strCount(Line, "ERROR") > 2 shows lines containing "ERROR" more than twice

regexCount(str, pattern)

Counts how many times the regular expression pattern matches in str. The search is case-insensitive by default (respects @cs/@ci directives). If str is an array, the result is an integer array with counts for each element. Zero-length matches are handled gracefully to avoid infinite loops.

Examples:

  • regexCount("test123abc456", "\d+") returns 2

  • regexCount("AAA BBB CCC", "[A-Z]+") returns 3

  • @cs regexCount("Test TEST", "TEST") returns 1

  • le:regexCount(Line, "\b(error|warning)\b") > 0 shows lines with error or warning keywords

strFind(str, substr[, occurrence])

Finds the position (0-based) of the Nth occurrence of substring substr in str. The optional occurrence parameter specifies which occurrence to find (0-based, default is 0 for the first occurrence). The search is case-insensitive by default (respects @cs/@ci directives). Returns none if the substring is not found or if the occurrence index is out of range. If str is an array, the result is an array of positions (or none values).

Examples:

  • strFind("hello world", "o") returns 4 (first 'o')

  • strFind("hello world", "o", 1) returns 7 (second 'o')

  • @cs strFind("Test TEST test", "test") returns 10 (case-sensitive)

  • strFind(array("abc", "def"), "b") returns array(1, none)

regexFind(str, pattern[, group[, occurrence]])

Finds the position (0-based) of the Nth occurrence of a regular expression match in str. The optional group parameter specifies which capture group to locate (0-based, default is 0 for the entire match). The optional occurrence parameter specifies which occurrence of the pattern to find (0-based, default is 0 for the first occurrence). The search is case-insensitive by default (respects @cs/@ci directives). Returns none if the pattern doesn't match, the group index is out of range, or the occurrence index is out of range. If str is an array, the result is an array of positions (or none values).

Examples:

  • regexFind("test123abc456", "\d+") returns 4 (position of "123")

  • regexFind("test123abc456", "\d+", 0, 1) returns 10 (position of "456", second match)

  • regexFind("abc-def-ghi", "([a-z]+)-([a-z]+)", 1) returns 0 (position of first capture group "abc")

  • regexFind("v1.0 and v2.5", "v(\d+)\.(\d+)", 1, 1) returns 10 (major version "2" in second occurrence)

  • regexFind(array("test123", "abc"), "\d+") returns array(4, none)

substr(source, start, count)

Returns a specific range of text from the string or string array as a String. If source is a string array, the result is a string array. Example: substr(Name, 0, 3)

replace(str, from, to)

Replaces all occurrences of the string from with to. If str is an array, the result is an array of strings with replacements applied. Example: replace(name, ".bak", ".txt")

regexReplace(str, pattern, replacement)

Replaces all matches of the regular expression pattern with the replacement string. Supports backreferences ($1, $2, etc.) in the replacement string. If str is an array, the result is an array of strings with replacements applied. Example: regexReplace(name, "^(\w+)_(\w+)$", "$2_$1") swaps words separated by underscore.

replaceWithList(str, filepath)

Replaces multiple strings in str using replacement rules loaded from a tab-separated file. The file format is one replacement rule per line: search_string<TAB>replacement_string. Lines starting with # are treated as comments and ignored. Empty lines are also ignored. If str is an array, the result is an array of strings with replacements applied.

File format example:

# Comment line
apple	orange
cat	dog
old	new

Examples:

  • replaceWithList(Name, "C:\Filters\replacements.txt") - applies replacements from file to file name

regexReplaceWithList(str, filepath)

Replaces strings in str using regular expression patterns loaded from a tab-separated file. The file format is one pattern per line: regex_pattern<TAB>replacement_string. The replacement string can include backreferences ($1, $2, etc.) to captured groups. Lines starting with # are treated as comments and ignored. Empty lines are also ignored. If str is an array, the result is an array of strings with replacements applied.

File format example:

# Comment line
\d+	NUMBER
(\d{4})-(\d{2})-(\d{2})	$1_$2_$3

Examples:

  • regexReplaceWithList(Name, "C:\Filters\regex_replacements.txt") - applies regex replacements to file name

regexExtract(str, pattern[, group[, offset]])

Captures text matching a regular expression pattern from the string. The optional group parameter specifies which capture group to extract (0-based). Group 0 (default) returns the entire match; groups 1, 2, etc. return the corresponding capture groups defined by parentheses in the pattern. The optional offset parameter specifies which occurrence of the pattern to capture (0-based). Offset 0 (default) returns the first match; offset 1 returns the second match, etc. This is useful for capturing the Nth occurrence in a line, such as the second number in a string. Returns none if the pattern doesn't match, the group index is out of range, or the offset exceeds the number of matches. If str is an array, the result is an array with captures for each element. The search is case-insensitive by default (respects @cs/@ci directives).

Examples:

  • regexExtract("abc123", "[a-z]+\d+") returns "abc123" (entire match)

  • regexExtract("abc123", "([a-z]+)(\d+)", 1) returns "abc" (first capture group)

  • regexExtract("abc123", "([a-z]+)(\d+)", 2) returns "123" (second capture group)

  • regexExtract("2025-05-16", "(\d{4})-(\d{2})-(\d{2})", 1) returns "2025"

  • regexExtract("user@example.com", "([^@]+)@([^@]+)", 1) returns "user"

  • regexExtract("user@example.com", "([^@]+)@([^@]+)", 2) returns "example.com"

  • regexExtract("value 123 and value 456", "(\d+)", 0, 0) returns "123" (first number)

  • regexExtract("value 123 and value 456", "(\d+)", 0, 1) returns "456" (second number)

  • regexExtract("v1.0.0 and v2.0.0", "v(\d+)\.(\d+)\.(\d+)", 1, 1) returns "2" (major version of second occurrence)

  • regexExtract("test", "\d+") returns none (no match)

  • regexExtract("abc", "([a-z])", 5) returns none (group out of range)

  • regexExtract(array("abc123", "def456"), "([a-z]+)(\d+)", 1) returns array("abc", "def")

  • @cs regexExtract("ABC123", "([a-z]+)", 1) returns none (case-sensitive, no match)

  • le:regexExtract(Line, "error:\s+(\w+)", 1) extracts error type from log lines

  • fe:regexExtract(Name, "v(\d+)\.(\d+)\.(\d+)", 1) = "2" filters files with major version 2

normalizeUnicode(str[, form])

Normalizes Unicode string. The optional form parameter specifies the normalization form: "NFC" or "C" (default), "NFD" or "D", "NFKC" or "KC", "NFKD" or "KD". Can also use numeric forms: 1=NFC, 2=NFD, 5=NFKC, 6=NFKD. If str is an array, the result is an array of normalized strings. Example: normalizeUnicode(name, "NFC")

toLower(str)

Converts all characters in the string to lowercase. If str is an array, the result is an array of lowercase strings. Example: toLower("Hello World") returns "hello world"

toUpper(str)

Converts all characters in the string to uppercase. If str is an array, the result is an array of uppercase strings. Example: toUpper("Hello World") returns "HELLO WORLD"

toHalfWidth(str)

Converts full-width characters to half-width characters. Primarily used for converting full-width alphanumeric and katakana characters to half-width. If str is an array, the result is an array of converted strings.

toFullWidth(str)

Converts half-width characters to full-width characters. Primarily used for converting half-width alphanumeric and katakana characters to full-width. If str is an array, the result is an array of converted strings.

toKatakana(str)

Converts hiragana characters to katakana. Non-hiragana characters remain unchanged. If str is an array, the result is an array of converted strings.

toHiragana(str)

Converts katakana characters to hiragana. Non-katakana characters remain unchanged. If str is an array, the result is an array of converted strings.

toSimplifiedChinese(str)

Converts traditional Chinese characters to simplified Chinese characters. Characters that don't have a simplified form remain unchanged. If str is an array, the result is an array of converted strings.

toTraditionalChinese(str)

Converts simplified Chinese characters to traditional Chinese characters. Characters that don't have a traditional form remain unchanged. If str is an array, the result is an array of converted strings.

trim(str)

Removes leading and trailing whitespace characters (space, tab, newline, carriage return) from the string. If str is an array, the result is an array of trimmed strings.

Examples:

  • trim(" hello ") returns "hello"

  • trim(array(" test ", " data ")) returns array("test", "data")

trimLeft(str)

Removes leading whitespace characters (space, tab, newline, carriage return) from the beginning of the string. Trailing whitespace is preserved. If str is an array, the result is an array of left-trimmed strings.

Examples:

  • trimLeft(" hello ") returns "hello "

trimRight(str)

Removes trailing whitespace characters (space, tab, newline, carriage return) from the end of the string. Leading whitespace is preserved. If str is an array, the result is an array of right-trimmed strings.

Examples:

  • trimRight(" hello ") returns " hello"

1.3.5.2. File Content Functions
lineCount(content)

Returns the number of lines in the file content or file content array as an Integer. If content is an array, the result is an integer array. Example: lineCount(Content)

sublines(content, start, count)

Extracts the specified number of lines starting from the given line index in the file content or file content array, and returns them as a single concatenated string. If content is an array, the result is an array of strings.

1.3.5.3. Type Conversion Functions
toNumber(str), toInt(str), toDouble(str)

Convert a string to a number. toNumber returns an integer or floating-point number depending on the input format; toInt returns only integers; toDouble returns only floating-point numbers. Commas in the input are ignored. Returns noneon parse failure. Example: le:toInt(Column("Count")) > 100

toDateTime(str)

Converts a string to a timestamp value. Supports multiple date/time formats. Returns noneif the string cannot be parsed. Example: toDateTime("2025-01-15") > today()

1.3.5.4. Date/Time Functions
now()

Returns the current date and time as a Timestamp value.

today()

Returns today's date as a Timestamp value representing 00:00:00.000 at the start of the day.

startOfWeek(timestamp)

Returns the first day of the week, which is always Sunday regardless of locale.

startOfMonth(timestamp)

Returns the first day of the month.

startOfYear(timestamp)

Returns the first day of the year.

toDateStr(timestamp)

Converts the given timestamp to a date string in yyyy-MM-dd format. If timestamp is a timestamp array, the result is a string array.

1.3.5.5. Math and Comparison Functions
abs(value)

Returns the absolute value of the integer or integer array. If value is an integer array, the result is an integer array.

isWithin(value, min, max)

Returns true if value is within the range [min, max] (inclusive on both ends). Supports integers, floating-point numbers, timestamps, and strings (case-insensitive comparison). If value is an array, the result is a boolean array with each element checked individually.

Examples:

  • isWithin(5, 1, 10) returns true

  • isWithin(Size, 1KB, 10MB) checks if any file size is between 1KB and 10MB

  • isWithin(Date, today() - 7days, today()) checks if file was modified within the last week

  • allof(isWithin(Size, 1KB, 10MB)) checks if all file sizes are between 1KB and 10MB

inRange(value, min, max)

Returns true if value is within the range [min, max) (inclusive on the lower bound, exclusive on the upper bound). Supports integers, floating-point numbers, timestamps, and strings (case-insensitive comparison). If value is an array, the result is a boolean array with each element checked individually.

Examples:

  • inRange(5, 1, 10) returns true

  • inRange(10, 1, 10) returns false

  • inRange(Size, 0, 1MB) checks if any file size is less than 1MB

  • anyof(inRange(Date, startOfMonth(today()), today())) checks if any file was modified this month (excluding today)

1.3.5.6. Array Functions
array(value1, value2, ...)

Creates an array from the given values. Example: array(1, 2, 3)

at(array, index)

Returns the element at the specified index (0-based). Negative indices count from the end. Example: at(array(1, 2, 3), -1) returns 3

anyof(booleans)

Returns true if any element in the boolean array satisfies the condition.

allof(booleans)

Returns true if all elements in the boolean array satisfy the condition.

allequal(array)

Returns true if all values in the array are equal.

len(value)

Returns the length of the value as an Integer.

Behavior:

  • Array: Returns the number of elements in the array

  • String: Returns the UTF-8 character count

  • None (monostate): Returns 0

  • Other scalar values (Integer, Real, Boolean, Timestamp, etc.): Returns 1

Examples:

  • len(array(1, 2, 3)) - returns 3

  • len("hello") - returns 5

  • len(123) - returns 1

  • len(Size) - returns the number of sides (2 or 3) in a folder comparison

1.3.5.7. Conditional Functions
if(condition, trueValue, falseValue)

Returns trueValue if condition evaluates to true, otherwise returns falseValue. This function performs short-circuit evaluation (it only evaluates the branch that will be returned).

Examples:

  • if(Size > 1MB, "large", "small") - returns "large" or "small" based on file size

  • if(Extension = "txt", "text file", "other file") - classifies files by extension

  • if(Exists, Size, 0) - returns file size or 0 if file doesn't exist

ifEach(conditionArray, trueValue, falseValue)

Element-wise conditional selection. For each element in conditionArray, returns the corresponding element from trueValue if the condition is true, otherwise returns the corresponding element from falseValue. If trueValue or falseValue is a scalar, it is broadcast to all elements.

Examples:

  • ifEach(Size > 1MB, "large", "small") - returns array of "large"/"small" labels for each file

  • ifEach(array(true, false, true), array("a", "b", "c"), array("x", "y", "z")) - returns array("a", "y", "c")

  • anyof(ifEach(Size > 100KB, Size < 10MB, false)) - checks if any file is between 100KB and 10MB

choose(index, value0, value1, ...)

Selects a value from the arguments based on index. If index is 0, returns value0; if 1, returns value1, etc. Negative indices are clamped to 0. Indices beyond the last value return the last value.

Examples:

  • choose(0, "first", "second", "third") - returns "first"

  • choose(DiffCode % 3, "equal", "different", "unique") - maps diff codes to labels

  • choose(5, "a", "b", "c") - returns "c" (out of bounds, returns last value)

chooseEach(indexArray, value0, value1, ...)

Element-wise value selection. For each index in indexArray, selects the corresponding value from the remaining arguments. If indexArray is a scalar, behaves like choose.

Examples:

  • chooseEach(array(0, 1, 2), "a", "b", "c") - returns array("a", "b", "c")

  • chooseEach(array(0, 0, 1), "x", "y") - returns array("x", "x", "y")

  • chooseEach(array(2, 0, 1), "first", "second", "third") - returns array("third", "first", "second")

1.3.5.8. Element-wise Logical Functions
andEach(value1, value2), orEach(value1, value2), notEach(value)

Element-wise logical operations. These functions operate on booleans, boolean arrays, or a combination of both:

  • andEach - Logical AND operation

  • orEach - Logical OR operation

  • notEach - Logical NOT operation (single argument)

When arguments are scalars, returns a scalar boolean result. When one argument is an array and the other is a scalar, the scalar is broadcast to all elements. When both arguments are arrays, performs element-wise operation.

Examples:

  • andEach(Size > 1KB, Size < 1MB) - files between 1KB and 1MB

  • orEach(Extension = "txt", Extension = "log") - txt or log files

  • notEach(Exists) - files that don't exist

  • allof(andEach(Exists, Size > 0)) - all files exist with non-zero size

  • anyof(notEach(Size > 1MB)) - any file 1MB or smaller

1.3.5.9. Diagnostic and Logging Functions
logError(value1, value2, ...), logWarn(value1, value2, ...), logInfo(value1, value2, ...)

Outputs the concatenated string representation of all arguments to the log (at error, warning, or information level respectively), separated by spaces, and returns the last argument value. These functions are useful for debugging filter expressions.

Examples (using return value):

  • logInfo("File size:", Size) > 1MB - logs the file size(s) and checks if greater than 1MB

  • logWarn("Processing:", Name) like "*.tmp" - logs the file name(s) and checks if it's a temporary file

  • Size > 1KB and logInfo("Large file:", Name) contains "test" - logs only when size condition is true, then checks name

1.3.6. Units

File sizes support these suffixes:

KB, MB, GB, TB

Time durations support these suffixes:

weeks, week, w, days, day, d, hours, hour, hr, h, minutes, minute, min, m, seconds, second, sec, s, milliseconds, millisecond, msec, ms

1.3.7. Examples

  • Size < 10KB - Any side's size is less than 10KB

  • LeftSize >= 10MB - Left side file is at least 10MB

  • allof(Size < 1MB) - All sides are under 1MB

  • abs(LeftSize - RightSize) < 1KB - Size difference is small

  • DateStr = "2025-07-20" - File was last modified on that date

  • Date >= today() - Modified today or later

  • Date > d"2026-05-21 07:16:33" - Modified after a specific date and time

  • isWithin(Date, d"2026-01-01", d"2026-12-31 23:59:59") - Modified during the year 2026

  • isWithin(Date, today() - 7days, today()) - File modified within the last week

  • inRange(Size, 1KB, 10MB) - File size is between 1KB (inclusive) and 10MB (exclusive)

  • allof(isWithin(Size, 100KB, 1MB)) - All file sizes are between 100KB and 1MB

  • AttrStr contains "R" - File is read-only

  • Name matches "file[0-9]\.txt" - Regex on filename

  • Content contains "Test" - File content includes keyword

  • sublines(Content, 0, 1) contains "XML" - First line contains "XML"

  • strCount(Content, "TODO") > 5 - File contains more than 5 TODO comments

  • regexCount(Content, "\bFIXME\b") > 0 - File contains at least one FIXME marker

  • strFind(Name, "_test") != none - Files containing "_test" in their name

  • strFind(Name, ".", 1) > 0 - Files with multiple dots in their name (second dot exists)

  • regexFind(Name, "\d{4}") < 5 - Files where a 4-digit number appears within the first 5 characters

  • regexExtract(Name, "v(\d+)\.(\d+)\.(\d+)", 1) = "2" - Files with major version 2 (e.g., "v2.16.48")

  • regexExtract(Name, "([^_]+)_([^_]+)\.txt", 2) like "test*" - Files where second part of name starts with "test"

  • le:regexExtract(Line, "(\d+)", 0, 1) - Extracts the second number in each line (offset=1)

  • (Extension = "log" and Size > 10MB) or (Date < today() - 7days) - Large log files or files older than a week

  • AttrStr not contains "H" and Name like "*.tmp" - Non-hidden temporary files

  • isWithin(Extension, "a", "m") and inRange(Size, 0, 1MB) - Files with extensions from 'a' to 'm' and size less than 1MB

  • toLower(Name) = "readme.txt" - Case-insensitive filename matching

  • toHalfWidth(Name) like "*.txt" - Match after converting full-width to half-width

  • trim(Name) = "readme.txt" - Match filename after removing leading/trailing whitespace

  • trimLeft(Column("Value")) = "123" - Match column value after removing leading whitespace (table mode)

  • trimRight(Line) contains "end" - Check if line (without trailing whitespace) contains "end"

  • EOL = 3 - Files with CRLF (Windows) line endings

  • EOLStr = "LF" - Files with LF (Unix) line endings

  • allof(EOL = 1) - Checks whether all compared files use LF line endings

  • leftprop("System.Title") != none - Left file has a title property set

  • prop("System.Author") = none - No author property is set on any side

  • if(LeftExists, LeftSize, 0) == 0 - Checks whether the left file is missing or empty

  • Different - Show only files/folders that are different (Display filter only)

  • Identical - Show only files/folders that are identical (Display filter only)

  • allof(Binary) - Show only files that are binary on all sides (Display filter only)

  • DifferentLeftMiddle and not DifferentMiddleRight - In 3-way comparison, show files where only left-middle pair differs (Display filter only)

2. שימוש במסנני קבצים

מסנני קבצים הם קבצי טקסט עם סיומת של flt. הם מאפשרים לך להחיל כללי סינון מרובים על השוואת תיקיות. בניגוד למסיכות קבצים, מסנני קבצים יכולים לכלול או לא לכלול התאמות.

WinMerge מתקין מספר מסנני קבצים מוגדרים מראש. אם מסנני קבצים אלה אינם מספקים את הסינון הדרוש לך, תוכל ליצור מסננים משלך. כדי להקל על משימה זו, WinMerge מספק גם קובץ תבנית בשם FileFilter.tmpl. סעיף זה מתאר כיצד להחיל מסנני קבצים על השוואות, ומתעד את תחביר מסנן הקבצים. סעיף 7, “שימוש בתיבת הדו-שיח מסננים” מתאר כיצד להוסיף, לערוך ולנהל מסננים.

2.1. מיקומי מסנני קבצים

WinMerge מזהה אוטומטית מסנני קבצים במיקומים אלה:

תיקיית המשנה מסננים בתיקיית ההתקנה של WinMerge

כאן מותקנים מסנני הקבצים המוגדרים מראש. לדוגמה, C:\Program Files\WinMerge\Filters. אתה יכול ליצור או להעתיק קבצי מסנן במיקום זה כדי להפוך אותם לזמינים לכל המשתמשים במערכת שלך.

לפני יצירת מסנן קבצים חדש, בדוק אם המסננים המוגדרים מראש כבר מכילים את מה שאתה צריך. אם לא, ייתכן שתמצא דוגמאות שימושיות לכללים בקבצים הקיימים.

תיקיית מסננים פרטית ברירת מחדל

המיקום של תיקייה זו מוגדר בדף מערכת של אפשרויות WinMerge. כברירת מחדל, הוא מצוין כתיקיית משנה בתיקיית פרופיל המשתמש שלך (לדוגמה, Documents ב-Windows 10). מסננים שנוצרים או מועתקים לכאן בדרך כלל גלויים רק לך. אם אתה יוצר מסנני קבצים חדשים, אתה יכול להעתיק אותם לכאן כדי לשמור אותם פרטיים.

לפני שתוכל להחיל מסנני קבצים הקיימים בכל תיקייה אחרת, עליך להתקין אותם תחילה.

2.2. החלת מסנני קבצים

אתה יכול להחיל מסנן קבצים באמצעות אחת מהשיטות הבאות:

  • כשאתה מפעיל השוואת תיקיות מתיבת הדו-שיח בחר קבצים או תיקיות:

    1. לאחר בחירת התיקיות 1 ו-2, לחץ על בחר ליד השדה מסנן.

    2. בתיבת הדו-שיח מסננים, השתמש בכרטיסייה מסנני קבצים כדי לבחור מסנן קבצים ולטעון אותו בשדה מסנן.

      שים לב

      אם מסנן קבצים מופעל כעת, מסנן הקבצים שנבחר כבר נטען בשדה מסנן.

    3. המשך בפעולת ההשוואה. הקובץ בשדה מסנן מוחל כשאתה מתחיל את הפעולה.

  • כדי לשנות את סינון הקבצים לאחר שכבר הפעלת פעולת השוואת תיקיות (לדוגמה, החלת מסנן אחר או השבתת סינון):

    1. לחץ על כליםמסננים.

    2. בתיבת הדו-שיח מסננים, הגדר את הגדרת מסנן הקבצים החדשה שלך ולחץ על אישור.

    3. הסינון החדש לא מוחל אוטומטית כשאתה סוגר את תיבת הדו-שיח מסננים: הקש F5 כדי לראות את התוצאות החדשות בחלון השוואת התיקיות.

  • כשאתה מפעיל השוואת תיקיות משורת הפקודה של WinMerge, השתמש בדגל -f כדי לציין מסנן קבצים.

2.3. תחביר מסנן קבצים

סעיף זה מתאר את התחביר של מסנני קבצים של WinMerge ומספק הנחיות לכתיבתם.

תו המפריד להערות הוא ##. לאחר מפריד הערות, כל התווים בשורה מתעלמים מהם. WinMerge מתעלם מרוב תווי הרווח הלבן בכללים. עם זאת, הערה חייבת תמיד להיות מוקדמת על ידי תו רווח לבן (רווח או טאב) אחד או יותר. כדי להשתמש ב-## כתווים בכלל, השמט את קידומת הרווח הלבן.

שתי השורות הנדרשות הראשונות של מסנן קבצים הן:

שם

שם המסנן המופיע בתיבת הדו-שיח קבצים

def

סוג הסינון שיש להחיל. ציין אחד מהערכים הבאים:

כלול

כולל הכל מלבד פריטים התואמים לכלל שצוין.

אל תכלול

לא כולל הכל מלבד פריטים התואמים לכלל שצוין.

כשאתה בוחר בשיטת החרגה, עליך גם להוסיף כלל d (ספרייה) שמציין את תיקיות המשנה. בדרך כלל כדאי לציין את כל תיקיות המשנה, כך:

d: \\*$ ## תיקיות משנה

עצה

אל תבלבל בין מונחים אלה. זכור, במסנני קבצים, כלל כלול לא מציין מה לכלול, הוא מציין מה לא לכלול. באופן דומה, אל תכלול לא מציין מה לא לכלול, הוא מציין מה לא לא לכלול.

Next, your file should contain one or more filter rules. You can add as many rules as you like. There must be one rule per line, and each rule must be entirely on one line (no line breaks are allowed in a rule). A rule begins with a type designator, followed by either a regular expression or a filter expression. The supported type designators are:

f: regexp

Match file names using regular expressions

f!: regexp

Exclude files matching regex (Available since 2.16.19)

d: regexp

Match folder names using regex

d!: regexp

Exclude folders matching regex (Available since 2.16.19)

fe: expr

Filter expression for files (e.g. fe:Size < 1KB) (Available since 2.16.49)

fe!: expr

Filter expression to exclude files (Available since 2.16.49)

de: expr

Filter expression for folders (Available since 2.16.49)

de!: expr

Filter expression to exclude folders (Available since 2.16.49)

e: expr

Filter expression applied to both files and folders (e.g. e:Name like "Common*.*") (Available since 2.16.56)

e!: expr

Filter expression to exclude both files and folders (Available since 2.16.56)

בין רבים מתווים מיוחדים של regexp, הבאים חשובים במיוחד בכללי מסנן קבצים:

^ (תחילת שורה)

נדרש לעתים קרובות כדי שהכללים יעבדו כראוי.

$ (סוף שורה)

נדרש לעתים קרובות כדי שהכללים יעבדו כראוי. לדוגמה:

\.c$ ## תואם רק לשמות קבצים עם הסיומת c.
\.c ## תואם לכל סיומת שמתחילה ב-c, כמו cpp ו-com.
\ (בריחה)

מכריח תווים מיוחדים להתאים לתווים רגילים. לדוגמה, כדי להתאים שם תיקייה, הקדם את תו המפריד של קו נטוי הפוך של התיקייה עם קו נטוי הפוך (\\). כדי להתאים את הנקודה בשם קובץ, ציין קו נטוי הפוך ואחריו נקודה (\.).

לא נעשה שימוש בתווים מיוחדים או בתווים כלליים כדי להתאים לשמות קבצים. כדי להתאים את כל שמות הקבצים מסוג מסוים, פשוט השמט את שם הקובץ.

הכללים אינם תלויי אותיות רישיות/קטנות. לדוגמה, f: \.bat$ תואם ל-winmerge.bat ו-compare.BAT.

דוגמה 9. דוגמאות לכללי סינון קבצים

כמה כללי סינון קבצים פשוטים:

f: \.cpp$ ## התאם לקבצי *.cpp
f: \.h$ ## התאם לקבצי *.h
f: ^My ## התאם לקבצי My*.*
f: Dlg\. ## התאם לקבצי *Dlg.*
d: \\test$ ## התאם לתיקיות test
d: ^\\Build$ ## התאם לתיקיות Build
d: Temp$ ## התאם לתיקיות *Temp (לדוגמה, FirstTemp)
d: Src ## התאם לתיקיות *Src*

כמה כללים עם ביטויים רגולריים מורכבים יותר:

f: ^\.#.*$ ## קבצי .#filename.version
f: Dlg\.c(pp)?$ ## קבצי *Dlg.c ו-*Dlg.cpp
f: ^I.*\.h$ ## קבצי I*.h
f: Srv[1-9]\.def$ ## קבצי *Srv1.def עד *Srv9.def
f: ^[h,k,m] ## קבצי h*.*, k*.* ו-m*.*

3. שימוש במסנני שורות

בהשוואת קבצים, אתה יכול להשתמש במסנני שורות כדי להתעלם משורות בודדות. לדוגמה, אתה עשוי להשתמש במסנני שורות כדי להתעלם מהערות או מסוג קוד שנוצר מסוים, כמו חותמות זמן של מערכת בקרת גרסאות. כל מסנן שורות הוא כלל, ואתה יכול להחיל כל מספר של מסנני שורות על השוואת קבצים.

כדי ללמוד כיצד להוסיף, לערוך ולנהל מסננים, ראה סעיף 7, “שימוש בתיבת הדו-שיח מסננים”.

3.1. החלת מסנני שורות

אתה יכול להחיל מסנני שורות באמצעות אחת מהשיטות הבאות:

  • כשאתה מפעיל השוואת קבצים מתיבת הדו-שיח בחר קבצים או תיקיות

    1. לאחר בחירת הקבצים 1 ו-2, לחץ על בחר ליד השדה מסנן.

    2. בתיבת הדו-שיח מסננים, השתמש בכרטיסייה מסנני שורות כדי להפעיל את מסנני השורות שבהם ברצונך להשתמש (אם יש), או כדי לראות אילו מסנני שורות מופעלים כעת.

      שים לב

      השדה מסנן לא מציין אילו מסנני שורות מופעלים.

    3. המשך בפעולת השוואת הקבצים. מסנני השורות המופעלים מוחלים כשאתה מתחיל את הפעולה.

  • לאחר שכבר הפעלת פעולת השוואת קבצים (לדוגמה, כדי להחיל מסננים שונים או להשבית סינון)

    1. לחץ על כליםמסננים.

    2. פתח את הכרטיסייה מסנני קבצים.

    3. סמן את מסנני השורות הבודדים שברצונך להחיל ובטל את הסימון של מסננים שאינך רוצה להחיל.

      אתה יכול גם להוסיף, לערוך ולהסיר מסננים מהרשימה באמצעות הכפתורים חדש, ערוך ו-הסר.

    4. כדי להפעיל סינון שורות, סמן את אפשר מסנני שורות. כדי לכבות סינון שורות, בטל את הסימון של האפשרות.

    5. לחץ על אישור כדי לסגור את תיבת הדו-שיח מסנני קבצים.

    6. לחץ על F5 כדי להחיל את השינויים שלך ולרענן את חלון השוואת הקבצים.

3.2. תחביר מסנן שורות

מסנן שורות הוא כלל המוערך כנגד כל הבדל בשורה בודדת בקבצים המושווים שלך, אם כללי מסנן שורות מופעלים. כאשר כלל תואם להבדל בשורה בודדת, ההבדל מתעלם ממנו.

הבדלים שמתעלמים מהם מסומנים בחלון השוואת הקבצים בצבע הבדל שמתעלמים ממנו (כפי שהוגדר בדף צבעים של אפשרויות WinMerge). זה מאפשר לך להבחין בין הבדלים שמתעלמים מהם מסוגים אחרים. עם זאת, אינך יכול לבחור או למזג הבדל שמתעלמים ממנו.

התאמת מסנן שורות ניתנת לתיאור במונחים של שני רעיונות:

  • כאשר כלל תואם לכל חלק מהשורה, ההבדל כולו מתעלמים ממנו. לכן, אינך יכול לסנן רק חלק משורה. לדוגמה, נניח שלשני קבצים יש את ההבדל הבא בשורה בודדת:

    קובץ 1: 

    # Jean Sibelius

    קובץ 2: 

    # Janne Sibelius

    ללא סינון, השורה מזוהה כהבדל. אבל אם נחיל כלל מסנן שורות עם הביטוי, ^#, השורות מדווחות כזהות, מכיוון שהביטוי מציין רק את התו הראשון, התואם בשני הקבצים.

  • כלל מוחל על הבדל מרובה שורות רק אם כל השורות תואמות. לדוגמה, שקול את ההבדל הזה בשתי שורות:

    קובץ 1: 

    # Jean Sibelius
    # Pekka Himanen

    קובץ 2: 

    # Janne Sibelius
    Pekka Himanen

    אותו כלל ^# תואם לשורה הראשונה, אך לא לשורה השנייה. לכן, לא מתעלמים מההבדל.

עצה

בדרך כלל מומלץ להשתמש בסמן תחילת שורה ( ^ ) וסוף שורה ( $ ) כדי לשלוט בדפוסים שלך במדויק, מכיוון שהכלל מוחל אם כל חלק משורה תואם לביטוי.

דוגמה 10. מסנני שורות לדוגמה

^MYTAG$

מסנן שורות שתואמות בדיוק ל-MYTAG

^::

מסנן שורות שמתחילות ב-::

^/\*.*\*/$

מסנן שורות שמתחילות ב-/* ומסתיימות ב-*/

^[1-5]00

מסנן שורות שמתחילות במספרים 100, 200, 300, 400 ו-500


דוגמה 11. כלל מסנן שורות התואם לשורות CVS Id

שורות CVS Id נראות כך:

// $Id: Filters.xml 7591 2013-01-20 15:47:42Z christianlist $

... וניתן לסנן עם כלל זה:

^// \WId: .*\$

דוגמה 12. סנן הערות מספרי שורות בקבצי po

הערות מספרי שורות של po נראות כך:

#: src/filename.c:766

... וניתן לסנן עם כלל זה:

^#

4. Using the display line filter

The display line filter controls which lines are visible in the File Compare window. Lines that do not match the filter are hidden, but the comparison result itself is not affected.

4.1. Opening the display filter bar

Use any of the following methods to open the display filter bar:

  • Click ViewDisplay Filter Bar, or press Ctrl+Shift+L.

  • Right-click selected text in the File Compare window and choose Add to FiltersAdd to Display Filters. WinMerge automatically builds a Line contains "..." expression from the selected text and opens the filter bar.

To remove the filter, clear the input field and press Enter. To hide the filter bar while keeping the filter active, click the close button.

4.2. Entering a filter

The display filter bar accepts input in two forms, determined by whether the input starts with the le: prefix:

Plain string (no prefix)

Input without the le: prefix is treated as a literal string. WinMerge shows only lines that contain that string. Internally, the input is equivalent to le:Line contains "input".

Example: entering TODO shows all lines that contain the text TODO.

le: prefix (filter expression)

If the input starts with le:, the remainder is interpreted as a filter expression. The full expression syntax described in סעיף 4.3, “Filter expression syntax” is available.

Example: le:Different and Line contains "ERROR"

חשוב

The le: prefix must appear at the very beginning of the input. If it appears anywhere else, the entire input is treated as a plain string.

For example, Hello or le:Line contains "Hello" does not contain a filter expression. The whole input is treated as a literal string search for the text Hello or le:Line contains "Hello".

4.3. Filter expression syntax

Display line filter expressions use the same engine as folder compare filter expressions (see סעיף 1.3, “Filter Expression Syntax”), with the following additional attributes and functions that operate on individual lines.

4.3.1. Line attributes

Attributes marked as supporting side-specific prefixes accept Left, Middle, and Right prefixes (e.g., LeftLine, RightLineLength). Attributes without a prefix evaluate across all panes.

Line

Text content of the current line. Supports side-specific prefixes. Example: Line contains "TODO"

LineLength

Length of the current line in characters. Supports side-specific prefixes. Example: LineLength > 120

LineNumber

Real line number in the file (1-based), not counting ghost lines. Supports side-specific prefixes. Example: LineNumber <= 50

ViewLineNumber

Display line number including ghost lines (1-based). Global attribute (no side prefix). Example: ViewLineNumber <= 100

Different

True if the line is part of a difference block. Global attribute. Example: Different

Identical

True if the line is identical across all panes. Global attribute.

Trivial

True if the line differs only in whitespace or other ignored content. Global attribute. Example: Different or Trivial

Exists

True if the line exists in the pane (not a ghost line). Supports side-specific prefixes. Example: LeftExists and not RightExists

Missing

True if the line is a ghost line in the pane. The opposite of Exists. Supports side-specific prefixes.

Moved

True if the line is detected as a moved line. Supports side-specific prefixes.

Bookmarked

True if the line has a bookmark. Supports side-specific prefixes.

DifferentLeftMiddle, DifferentMiddleRight, DifferentLeftRight

True if the indicated pair of panes differs on this line. 3-way comparisons only (except DifferentLeftRight which also works in 2-way). Global attributes. Example: DifferentLeftMiddle and not DifferentMiddleRight

EOL

End-of-line style for the current line as an integer value. Supports side-specific prefixes. Values: 0 = None, 1 = LF, 2 = CR, 3 = CRLF Example: le:EOL = 3 shows only lines with CRLF endings

EOLStr

End-of-line style for the current line as a string. Supports side-specific prefixes. Values: "None", "LF", "CR", "CRLF" Example: le:EOLStr = "LF" shows only lines with LF endings

Column, ColumnCount (table mode only)

Cell content and column count in CSV/table mode. Support side-specific prefixes. Example: Column("Status") = "FAIL"

LineAt(lineNumber), LineOffsetAt(offset)

Text of the line at an absolute line number or at a relative offset from the current line. Supports side-specific prefix functions. Example: le:Different and RightLineOffsetAt(-1) matches "^//"

Column(indexOrName), ColumnAt(line, indexOrName), ColumnOffsetAt(offset, indexOrName) (table mode only)

Cell content by index or name, at the current, absolute, or relative line. Example: le:RightColumn("Category") != ColumnOffsetAt(-1, "Category")

4.3.2. Line functions

Display line filter expressions can also use functions described in סעיף 1.3.5, “Functions”.

matchContext(expr, linesBefore, linesAfter)

True if the current line is within linesBefore lines before or linesAfter lines after any line matching expr. Example: le:matchContext(Different, 3, 3)

matchNumber(expr)

1-based index of the current line within all matching lines. Returns noneif the line does not match. Example: le:matchNumber(Different) = 1 shows only the first line that matches (the first difference line).

matchCount(expr)

Total number of lines matching expr across the whole file. Example: le:matchNumber(Different) = matchCount(Different) shows only the last line that matches (the last difference line).

matchBlockNumber(expr)

Returns the 1-based block number of the matching block containing the current line. Returns none if the current line is not in any matching block. Example: le:matchBlockNumber(Different) = 1 shows only lines in the first difference block.

matchBlockOffset(expr)

Returns the 1-based offset of the current line within the matching block. Returns none if the current line is not in any matching block. Example: le:matchBlockOffset(Different) = 1 shows only the first line of each difference block.

matchBlockSize(expr)

Returns the size (number of lines) of the matching block containing the current line. Returns none if the current line is not in any matching block. Example: le:matchBlockSize(Different) > 5 shows only lines in difference blocks larger than 5 lines.

matchBlockCount(expr)

Total number of matching blocks in the file. Example: le:matchBlockNumber(Different) = matchBlockCount(Different) shows only lines in the last difference block.

matchDistance(expr), matchDistanceBefore(expr), matchDistanceAfter(expr)

Distance in lines to the nearest matching range (both directions, before only, or after only). Example: le:matchDistance(Different) <= 5

matchInside(beginExpr, endExpr)

True if the current line falls between a line matching beginExpr and the next line matching endExpr (inclusive). Example: le:matchInside(Line matches "^#ifdef", Line matches "^#endif")

average(expr), average(expr, condition)

Calculates the average (arithmetic mean) of numeric values produced by evaluating expr for all lines in the file. If condition is provided, only lines where condition evaluates to true are included in the calculation. Non-numeric results are ignored. Returns noneif no numeric values are found. Example: le:toInt(Column("Price")) > average(toInt(Column("Price"))) shows rows where the price exceeds the average price. Example with condition: le:average(toInt(Column("Score")), Column("Status") = "PASS") calculates the average score for rows with status "PASS".

maximum(expr), maximum(expr, condition)

Returns the maximum value among all results produced by evaluating expr for all lines in the file. If condition is provided, only lines where condition evaluates to true are considered. Works with numeric values, strings (alphabetical comparison), and timestamps. Returns noneif no values are found. Example: le:toInt(Column("Quantity")) = maximum(toInt(Column("Quantity"))) shows rows with the highest quantity.

minimum(expr), minimum(expr, condition)

Returns the minimum value among all results produced by evaluating expr for all lines in the file. If condition is provided, only lines where condition evaluates to true are considered. Works with numeric values, strings (alphabetical comparison), and timestamps. Returns noneif no values are found. Example: le:Column("Status") = minimum(Column("Status")) shows rows with the alphabetically first status value.

sum(expr), sum(expr, condition)

Calculates the sum of all numeric values produced by evaluating expr for all lines in the file. If condition is provided, only lines where condition evaluates to true are included in the calculation. Non-numeric results are ignored. Returns noneif no numeric values are found. Example: le:toInt(Column("Quantity")) / sum(toInt(Column("Quantity"))) * 100 calculates each row's percentage of the total quantity. Example with condition: le:sum(toInt(Column("Sales")), Column("Region") = "East") calculates total sales for the "East" region.

4.3.3. Examples

קלט Effect
TODO Shows lines containing the text "TODO" (plain string)
le:Different Shows only lines in difference blocks
le:Different or Trivial Shows differences, excluding whitespace-only changes
le:matchContext(Different, 3, 3) Shows difference blocks with 3 lines of context on each side
le:matchNumber(Different) = 1 Shows only the first difference line
le:matchBlockNumber(Different) <= 3 Shows only lines in the first 3 difference blocks
le:matchBlockOffset(Different) = 1 Shows only the first line of each difference block
le:matchBlockSize(Different) > 10 Shows only lines in difference blocks larger than 10 lines
le:Different and Line contains "ERROR" Shows lines that are both different and contain "ERROR"
le:strFind(Line, "TODO") < 10 Shows lines where "TODO" appears within the first 10 characters
le:regexFind(Line, "\d{4}") != none Shows lines containing a 4-digit number
le:matchContext(Bookmarked, 2, 2) Shows bookmarked lines with 2 lines of context
le:LineNumber <= 50 Shows only the first 50 lines
le:EOL = 3 Shows only lines with CRLF (Windows) line endings
le:EOLStr = "LF" Shows only lines with LF (Unix) line endings
le:allof(EOL = 1) Shows lines where all panes use LF line endings
le:toInt(Column("Count")) > 100 Shows rows where the "Count" column value exceeds 100 (table mode)

5. Using the display file/folder filter

The display file/folder filter in the Folder Compare window works the same way as the display line filter in the File Compare window, but operates on files and folders instead of lines. It controls which items are visible without affecting the comparison result.

To open the display filter bar, click ViewDisplay Filter Bar, or press Ctrl+Shift+L.

The filter bar accepts the same syntax as the Filter field in the Select Files or Folders dialog. See סעיף 1.2, “תחביר ודוגמה של מסיכת קבצים” and סעיף 1.3, “Filter Expression Syntax” for details.

To remove the filter, clear the input field and press Enter. To hide the filter bar while keeping the filter active, click the close button.

Examples:

  • *.cpp;*.h - shows C++ source and header files

  • !.git\;!.vs\ - excludes .git and .vs folders

  • fe:Different - shows only different files

  • de:Items > 10 - shows folders with more than 10 items

  • e:Date > today() - 7days - shows items modified within the last week

6. שימוש במסנני החלפה

TBD

7. שימוש בתיבת הדו-שיח מסננים

סעיף זה מתאר את תיבת הדו-שיח מסננים, המספקת פונקציות ליצירה וניהול של מסנני קבצים ומסנני שורות.

כדי לפתוח את תיבת הדו-שיח מסננים, השתמש באחת מהשיטות הבאות:

  • בתיבת הדו-שיח בחר קבצים או תיקיות, לחץ על בחר מימין לשדה מסנן. אתה משתמש בשיטה זו כשאתה רוצה להחיל מסנן קבצים על פעולת השוואת תיקיות.

  • לחץ על כליםמסננים. ניתן להשתמש בשיטה זו בכל עת, למעט כאשר תיבת הדו-שיח בחר קבצים או תיקיות פתוחה.

בתיבת הדו-שיח מסננים יש כרטיסייה לכל סוג של מסנן WinMerge:

מסנני קבצים

בחר כרטיסייה זו כדי לעבוד עם מסנני קבצים עבור פעולות השוואת תיקיות.

מסנני שורות

בחר כרטיסייה זו כדי לעבוד עם מסנני שורות עבור פעולות השוואת קבצים.

מסנני החלפה

בחר כרטיסייה זו כדי לעבוד עם מסנני החלפה עבור פעולות השוואת קבצים.

Display Line Filter

The display line filter is not configured through this dialog. Open it via ViewDisplay Filter Bar. See סעיף 4, “Using the display line filter”.

7.1. שימוש בכרטיסייה מסנני קבצים

החלק העיקרי של כרטיסייה זו הוא רשימה של מסנני קבצים הזמינים עבור פעולות השוואת תיקיות. הרשימה כוללת מסנני קבצים משותפים, פרטיים ומוגדרים ש-WinMerge מכיר, כמתואר ב-סעיף 2.1, “מיקומי מסנני קבצים”.

7.1.1. הפעלה והשבתה של מסנני קבצים

עליך להפעיל מסנן קבצים כדי להפוך אותו לזמין בפעולת השוואת תיקיות, או להשבית מסנן נוכחי כדי למנוע את השימוש בו:

  1. פתח את תיבת הדו-שיח מסננים, אם היא עדיין לא פתוחה.

  2. בחר מסנן קבצים או <ללא> מהרשימה.

  3. לחץ על אישור כדי לסגור את תיבת הדו-שיח מסננים.

ישנן מספר דרכים להחיל מסנני קבצים לאחר הפעלתם. לפרטים, ראה סעיף 2.2, “החלת מסנני קבצים”.

7.1.2. הגדרת מסנני קבצים

השתמש בלחצנים אלה כדי לנהל את רשימת מסנני קבצים שלך וליצור מסנני קבצים חדשים:

בדוק

בחר מסנן קבצים ברשימה ולחץ על בדוק כדי לראות במהירות כיצד המסנן עובד. ראה סעיף 7.1.4, “בדיקת כללי מסנן קבצים” לפרטים.

התקן

מאפשר לך לאתר מסנן קבצים ומוסיף אותו לרשימת המסננים. מסנני קבצים שאינם בתיקייה המשותפת או הפרטית המוגדרת כברירת מחדל אינם מזוהים אלא אם אתה מתקין אותם.

חדש

יוצר עותק חדש של תבנית קבצים בתיקיות המסננים המשותפות או הפרטיות, ופותח אותו בעורך ברירת המחדל שלך. ערוך את התבנית והוסף את הכללים שלך, כמתואר ב-סעיף 7.1.3, “יצירת מסנן קבצים”.

ערוך

בחר מסנן קבצים ברשימה ולחץ על ערוך כדי לפתוח את הקובץ בעורך ברירת המחדל שלך.

מחק

בחר מסנן קבצים ברשימה ולחץ על מחק כדי למחוק את הקובץ ולהסיר אותו מהרשימה. כן, הקובץ באמת נמחק!

השינויים שלך נשמרים כשאתה לוחץ על אישור כדי לסגור את תיבת הדו-שיח מסננים. מסנני שורות מאוחסנים ברישום של Windows.

7.1.3. יצירת מסנן קבצים

אם מסנני הקבצים המותקנים עם WinMerge אינם מספקים את הסינון הדרוש לך, אתה יכול ליצור מסננים משלך:

  1. לחץ על כליםמסננים. או, מתיבת הדו-שיח בחר קבצים או תיקיות, לחץ על בחר מימין לשדה מסנן.

  2. בכרטיסייה מסנני קבצים של תיבת הדו-שיח מסננים, לחץ על חדש.

  3. בתיבת הדו-שיח מסנן משותף או פרטי, בחר מסנן משותף או מסנן פרטי (ראה סעיף 2.1, “מיקומי מסנני קבצים” לשימושים בהם) ולחץ על אישור.

    תיבת הדו-שיח בחר שם קובץ למסנן חדש נפתחת בתיקיית הקבצים המשותפת או הפרטית במערכת שלך (אם התיקייה הפרטית אינה קיימת, WinMerge יוצר אותה).

  4. בתיבת הדו-שיח בחר שם קובץ למסנן חדש, הזן שם קובץ חדש ולחץ על שמור.

    שים לב

    אל תבחר שם קובץ קיים: כדי לערוך קובץ קיים, חזור לשלב 2 ולחץ על ערוך במקום על חדש.

    WinMerge מאתחל את הקובץ החדש עם התוכן של התבנית FileFilter.tmpl, ופותח אותו בעורך הטקסט המוגדר כברירת מחדל שלך.

  5. פעל בהתאם להוראות התבנית כדי לערוך את התבנית, לעדכן את שם מציין המיקום והתיאור ולהוסיף כללי מסנן כמתואר ב-סעיף 2.3, “תחביר מסנן קבצים”. שמור את הקובץ בעורך הטקסט שלך.

    עצה

    אם אתה רוצה לבדוק במהירות כלל שאתה מגדיר, נסה ללחוץ על בדוק בתיבת הדו-שיח מסננים. ראה סעיף 7.1.4, “בדיקת כללי מסנן קבצים” לפרטים.

  6. אם יצרת את מסנן הקבצים שלך באחת מתיקיות מסננים הסטנדרטיות, ותיבת הדו-שיח מסננים אינה מציגה את מסנן הקבצים החדש שלך, נסה ללחוץ על אישור כדי לסגור אותה, ואז לחץ על כליםמסננים שוב כדי לפתוח אותה מחדש. רשימת מסנני קבצים צריכה לכלול כעת את מסנן הקבצים החדש.

    אם שמרת את הקובץ במיקום חלופי במערכת הקבצים שלך), WinMerge לא יכול לזהות אותו אלא אם אתה מתקין אותו. כדי להפוך מסנן קבצים לניתן לזיהוי בכל מקום במערכת שלך:

    1. לחץ על התקן בתיבת הדו-שיח מסננים.

    2. בתיבת הדו-שיח אתר קובץ מסנן להתקנה, נווט לקובץ flt במערכת שלך ולחץ על פתח. רשימת מסנני הקבצים צריכה לכלול כעת את מסנן הקבצים המותקן.

7.1.4. בדיקת כללי מסנן קבצים

השתמש בתיבת הדו-שיח בדוק מסנן כדי לבדוק במהירות מסנן קבצים כנגד נתוני דוגמה, כדי לעזור לך לפתח כללים חדשים או כדי להבין כיצד כללים קיימים עובדים. זה יכול להיות קל יותר מאשר הפעלת פעולת השוואה מלאה.

החל מתיבת הדו-שיח מסננים:

  1. בכרטיסייה מסנני קבצים, בחר את מסנן הקבצים שברצונך לבדוק.

  2. אם אתה רוצה לראות את הכללים שאתה הולך לבדוק, לחץ על ערוך עכשיו כדי לפתוח את הקובץ כדי שתוכל לצפות בו במהלך השלבים הבאים.

  3. לחץ על בדוק.

  4. בתיבת הדו-שיח בדוק מסנן, בחר את סוג הכלל לבדיקה:

    • כדי לבדוק כלל קובץ f: במסנן הקבצים שלך, בטל את הסימון של האפשרות שם תיקייה.

    • כדי לבדוק כלל תיקייה d:, סמן את האפשרות שם תיקייה.

  5. הזן את הטקסט לבדיקה.

    הטקסט צריך להיות מתאים לסוג הכלל שאתה בודק. לדוגמה, אם סימנת את האפשרות שם תיקייה, סביר להניח שתרצה להזין שם תיקייה, כגון \temp.

    התיבה תוצאה מציגה את הערך שהזנת, ואחריו את הסטטוס שלו: עבר או נכשל.

7.2. שימוש בכרטיסייה מסנני שורות

השתמש בכרטיסייה זו כדי להגדיר ולהפעיל מסנני שורות עבור פעולות השוואת קבצים. הכרטיסייה כוללת רשימה של כללים. כל כלל מכיל ביטוי רגולרי יחיד. אתה יכול להחיל כל שילוב של כללים מהרשימה על השוואת קבצים.

7.2.1. הגדרת מסנני שורות

מתחת לרשימת ביטויים רגולריים יש תיבת עריכה ולחצנים שבהם תוכל להשתמש כדי לתחזק את הרשימה בכל עת על ידי הוספה, עריכה והסרה של כללים.

כדי להוסיף כלל חדש:

  1. לחץ על חדש. סמן העריכה שלך מופעל אוטומטית בתיבת העריכה.

  2. הזן ביטוי בתיבת העריכה שמתחת לרשימת ביטויים רגולריים.

  3. לחץ על שמור כדי לטעון את הביטוי בשורה חדשה ברשימה.

כדי לערוך כלל קיים:

  1. בחר את השורה ולחץ על ערוך.

  2. ערוך את הביטוי בתיבת העריכה.

  3. לחץ על שמור כשסיימת.

כדי למחוק כלל קיים, בחר (סמן) את הכלל ולחץ על הסר.

7.2.2. הפעלה והשבתה של מסנני שורות

  1. ברשימת ביטויים רגולריים, סמן רק את המסננים שברצונך להחיל ובטל את הסימון של כל המסננים שאינך רוצה להחיל.

  2. סמן או בטל את הסימון של האפשרות אפשר מסנני שורות. אם תפעיל סינון, כל הכללים המסומנים כעת ברשימת ביטוי רגולרי ישמשו. אם הסינון כבוי, לא ישמשו כללים גם אם הם מסומנים.

  3. לחץ על אישור כדי לסגור את תיבת הדו-שיח מסננים ולשמור את ההגדרות שלך.

ישנן מספר דרכים להחיל מסנני קבצים לאחר הפעלתם. לפרטים, ראה סעיף 3.1, “החלת מסנני שורות”.

7.3. שימוש בכרטיסייה מסנני החלפה

TBD

7.3.1. הגדרת מסנני החלפה

TBD

7.3.2. הפעלה והשבתה של מסנני החלפה

TBD

8. קבלת עזרה בביטויים רגולריים

ביטויים רגולריים יכולים להיות מורכבים מאוד. למרבה המזל, רוב מסנני הקבצים ב-WinMerge כוללים ביטויי סיומת פשוטים, כפי שמוצג בדוגמאות בנושא זה. קבצי המסנן המותקנים עם WinMerge כוללים דוגמאות שימושיות רבות אחרות.

לבסוף, ישנם משאבים רבים באינטרנט לעזרה ב-regexps, כולל אתרים אלה: