כשאתה משווה קבצים או תיקיות, אתה יכול להשתמש במסננים כדי לצמצם את היקף ההשוואה. זה יכול להיות שימושי כשאתה רוצה לפשט את תוצאת ההשוואה על ידי ביטול הבדלים שאינך מעוניין בהם. מסננים הם כללים המבוססים על ביטויים רגולריים. 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.
קבצים ותיקיות שמסוננים מוסתרים בתוצאה כברירת מחדל, וזה בדרך כלל מה שאתה רוצה. אתה יכול ללחוץ על → כדי לבטל את ההסתרה של פריטים מסוננים, אך חלון השוואת התיקיות מציג רק מידע מינימלי עליהם. לדוגמה, אינך יכול לדעת אם קובץ שדולג הוא קובץ טקסט או בינארי.
מסנני שורות מוחלים רק על פעולות השוואת קבצים. הם מאפשרים לך להתעלם מהבדלי שורה בודדים.
מסנני החלפה מוחלים רק על פעולות השוואת קבצים. הם מחליפים את המחרוזות בגוש ה-diff במחרוזות שצוינו, משווים אותן ומתעלמים מגוש ה-diff אם תוצאות ההחלפה תואמות. הם שימושיים להתעלמות ממספר רב של שינויים לא מעניינים.
אתה יכול להשתמש במסיכות קבצים אחת או יותר שמציינות סיומות קבצים שיכללו בהשוואת תיקיות. כל שאר הקבצים מושמטים מהבחירה שלך.
הגדר והחל מסיכת קבצים בזמן שאתה מפעיל את פעולת השוואת התיקיות שלך:
אם אתה משתמש בתיבת הדו-שיח בחר קבצים או תיקיות, לאחר בחירת התיקיות 1 ו-2, הזן מסיכת קבצים אחת או יותר בשדה מסנן. המסכות מוחלות כשאתה מתחיל את פעולת השוואת התיקיות.
אם אתה משתמש בשורת הפקודה של WinMerge, השתמש בדגל -f כדי
לציין מסיכות קבצים (ראה את הדוגמה בסעיף הבא).
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:
*.extFile mask by extension (e.g., *.txt)
*.Files with no extension (e.g., README)
*.extExclude 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)
regexpMatch file names using regular expressions (Available since 2.16.49)
regexpExclude files matching regex (Available since 2.16.49)
regexpMatch folder names using regex (Available since 2.16.49)
regexpExclude folders matching regex (Available since 2.16.49)
exprFilter expression for files (e.g. fe:Size < 1KB) (Available since 2.16.49)
exprFilter expression to exclude files (Available since 2.16.49)
exprFilter expression for folders (Available since 2.16.49)
exprFilter expression to exclude folders (Available since 2.16.49)
file filter nameApply 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"
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.
Supported literal types include:
Boolean: true,
false
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")
Internally, values may be of the following types: Boolean, Integer, Real,
Timestamp, String, File Content, Array, or undefined.
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.
Returns true if the file exists, false
otherwise
File name
Returns the filename without extension. For example, "document.txt" returns "document".
File extension
Returns true if the item is a folder/directory, false if it's a file.
Returns the relative path excluding the file name and base folder
Returns the full path of the file
File size
Last modified timestamp
Last modified date string in yyyy-MM-dd format
Creation date timestamp
Returns the file attributes as an integer value
Returns file attribute string. Examples: "R" for
Read-only, "H" for Hidden, "A" for
Archive, "S" for System file.
The following attributes are available only for file comparison items. When used with folder items, the behavior is undefined.
Content of the file. Returns a FileContent-type value. Only
contains and recontains can be used
with this type.
The following attributes are available only for folder comparison items. When used with file items, the behavior is undefined.
Number of files directly contained in the folder.
Number of files contained in the folder, including all subfolders.
Number of items (files and subfolders) directly contained in the folder.
Number of items (files and subfolders) contained in the folder, including all subfolders.
Total size of all files directly contained in the folder, in bytes.
Total size of all files contained in the folder, including all subfolders, in bytes.
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).
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).
Returns an array of property values (Left, Middle, Right) for the specified
canonical property name. Example: prop("System.Title")
Property value of the left-side file. Example:
leftprop("System.FileOwner")
Property value of the middle file (in 3-way comparison).
Property value of the right-side file.
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.
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.
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.
דוגמה 5. 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)
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.
All string comparison operators (such as =,
!=, like, matches,
contains, and recontains) are
currently case-insensitive.
<, <=, >,
>=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, notLogical operators
likeWildcard string match
You can also use not like to perform the inverse match.
matchesMatches regular expressions
You can also use not matches to perform the inverse
match.
containsChecks if a string contains a substring
You can also use not contains to check for absence of the
substring.
recontainsChecks if any substring matches a regular expression
You can also use not recontains to ensure no match
exists.
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)
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.
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)
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)
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")
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.
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")
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"
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"
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.
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.
str)
Converts hiragana characters to katakana. Non-hiragana characters remain
unchanged. If str is an array, the result is an
array of converted strings.
str)
Converts katakana characters to hiragana. Non-katakana characters remain
unchanged. If str is an array, the result is an
array of converted strings.
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.
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.
Returns the current date and time as a Timestamp value.
Returns today's date as a Timestamp value representing
00:00:00.000 at the start of the day.
timestamp)Returns the first day of the week, which is always Sunday regardless of locale.
timestamp)Returns the first day of the month.
timestamp)Returns the first day of the year.
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.
value)Returns the absolute value of the integer or integer
array. If value is an integer array,
the result is an integer array.
booleans)Returns true if all elements in the boolean
array satisfy the condition.
array)Returns true if all values in the array are equal.
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
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)
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
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
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
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)
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")
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
File sizes support these suffixes:
KB, MB, GB, TBTime 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, msSize < 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
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"
(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
מסנני קבצים הם קבצי טקסט עם סיומת של
flt. הם מאפשרים לך להחיל כללי סינון מרובים על השוואת
תיקיות. בניגוד למסיכות קבצים, מסנני קבצים יכולים לכלול או לא לכלול התאמות.
WinMerge מתקין מספר מסנני קבצים
מוגדרים מראש. אם מסנני קבצים אלה אינם מספקים את הסינון הדרוש לך, תוכל ליצור
מסננים משלך. כדי להקל על משימה זו, WinMerge מספק גם קובץ תבנית בשם
FileFilter.tmpl. סעיף זה מתאר כיצד להחיל מסנני קבצים על
השוואות, ומתעד את תחביר מסנן הקבצים. סעיף 5, “שימוש בתיבת הדו-שיח מסננים” מתאר
כיצד להוסיף, לערוך ולנהל מסננים.
WinMerge מזהה אוטומטית מסנני קבצים במיקומים אלה:
כאן מותקנים מסנני הקבצים המוגדרים מראש. לדוגמה, C:\Program
Files\WinMerge\Filters. אתה יכול ליצור או להעתיק קבצי מסנן במיקום
זה כדי להפוך אותם לזמינים לכל המשתמשים במערכת שלך.
לפני יצירת מסנן קבצים חדש, בדוק אם המסננים המוגדרים מראש כבר מכילים את מה שאתה צריך. אם לא, ייתכן שתמצא דוגמאות שימושיות לכללים בקבצים הקיימים.
המיקום של תיקייה זו מוגדר בדף מערכת של אפשרויות WinMerge. כברירת מחדל, הוא
מצוין כתיקיית משנה בתיקיית פרופיל המשתמש שלך (לדוגמה,
Documents ב-Windows 10). מסננים שנוצרים או מועתקים לכאן
בדרך כלל גלויים רק לך. אם אתה יוצר מסנני קבצים חדשים, אתה יכול להעתיק אותם
לכאן כדי לשמור אותם פרטיים.
לפני שתוכל להחיל מסנני קבצים הקיימים בכל תיקייה אחרת, עליך להתקין אותם תחילה.
אתה יכול להחיל מסנן קבצים באמצעות אחת מהשיטות הבאות:
כשאתה מפעיל השוואת תיקיות מתיבת הדו-שיח בחר קבצים או תיקיות:
לאחר בחירת התיקיות 1 ו-2, לחץ על ליד השדה מסנן.
בתיבת הדו-שיח מסננים, השתמש בכרטיסייה מסנני קבצים כדי לבחור מסנן קבצים ולטעון אותו בשדה מסנן.
אם מסנן קבצים מופעל כעת, מסנן הקבצים שנבחר כבר נטען בשדה מסנן.
המשך בפעולת ההשוואה. הקובץ בשדה מסנן מוחל כשאתה מתחיל את הפעולה.
כדי לשנות את סינון הקבצים לאחר שכבר הפעלת פעולת השוואת תיקיות (לדוגמה, החלת מסנן אחר או השבתת סינון):
לחץ על → .
בתיבת הדו-שיח מסננים, הגדר את הגדרת מסנן הקבצים החדשה שלך ולחץ על .
הסינון החדש לא מוחל אוטומטית כשאתה סוגר את תיבת הדו-שיח מסננים: הקש F5 כדי לראות את התוצאות החדשות בחלון השוואת התיקיות.
כשאתה מפעיל השוואת תיקיות משורת הפקודה
של WinMerge, השתמש בדגל -f כדי לציין מסנן קבצים.
סעיף זה מתאר את התחביר של מסנני קבצים של WinMerge ומספק הנחיות לכתיבתם.
תו המפריד להערות הוא ##. לאחר מפריד הערות, כל התווים בשורה
מתעלמים מהם. WinMerge מתעלם מרוב תווי הרווח הלבן בכללים. עם זאת, הערה חייבת
תמיד להיות מוקדמת על ידי תו רווח לבן (רווח או טאב) אחד או יותר. כדי להשתמש
ב-## כתווים בכלל, השמט את קידומת הרווח הלבן.
שתי השורות הנדרשות הראשונות של מסנן קבצים הן:
שם המסנן המופיע בתיבת הדו-שיח קבצים
סוג הסינון שיש להחיל. ציין אחד מהערכים הבאים:
כולל הכל מלבד פריטים התואמים לכלל שצוין.
לא כולל הכל מלבד פריטים התואמים לכלל שצוין.
כשאתה בוחר בשיטת החרגה, עליך גם להוסיף כלל 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:
regexpMatch file names using regular expressions
regexpExclude files matching regex (Available since 2.16.19)
regexpMatch folder names using regex
regexpExclude folders matching regex (Available since 2.16.19)
exprFilter expression for files (e.g. fe:Size < 1KB) (Available since 2.16.49)
exprFilter expression to exclude files (Available since 2.16.49)
exprFilter expression for folders (Available since 2.16.49)
exprFilter expression to exclude folders (Available since 2.16.49)
בין רבים מתווים מיוחדים של regexp, הבאים חשובים במיוחד בכללי מסנן קבצים:
נדרש לעתים קרובות כדי שהכללים יעבדו כראוי.
נדרש לעתים קרובות כדי שהכללים יעבדו כראוי. לדוגמה:
\.c$ ## תואם רק לשמות קבצים עם הסיומתc. \.c ## תואם לכל סיומת שמתחילה ב-c, כמוcppו-com.
מכריח תווים מיוחדים להתאים לתווים רגילים. לדוגמה, כדי להתאים שם תיקייה, הקדם
את תו המפריד של קו נטוי הפוך של התיקייה עם קו נטוי הפוך
(\\). כדי להתאים את הנקודה בשם קובץ, ציין קו נטוי הפוך ואחריו
נקודה (\.).
לא נעשה שימוש בתווים מיוחדים או בתווים כלליים כדי להתאים לשמות קבצים. כדי להתאים את כל שמות הקבצים מסוג מסוים, פשוט השמט את שם הקובץ.
הכללים אינם תלויי אותיות רישיות/קטנות. לדוגמה, f: \.bat$ תואם
ל-winmerge.bat ו-compare.BAT.
דוגמה 6. דוגמאות לכללי סינון קבצים
כמה כללי סינון קבצים פשוטים:
f: \.cpp$ ## התאם לקבצי*.cppf: \.h$ ## התאם לקבצי*.hf: ^My ## התאם לקבציMy*.*f: Dlg\. ## התאם לקבצי*Dlg.*d: \\test$ ## התאם לתיקיותtestd: ^\\Build$ ## התאם לתיקיותBuildd: Temp$ ## התאם לתיקיות*Temp(לדוגמה,FirstTemp) d: Src ## התאם לתיקיות*Src*
כמה כללים עם ביטויים רגולריים מורכבים יותר:
f: ^\.#.*$ ## קבצי.#filename.versionf: Dlg\.c(pp)?$ ## קבצי*Dlg.cו-*Dlg.cppf: ^I.*\.h$ ## קבציI*.hf: Srv[1-9]\.def$ ## קבצי*Srv1.defעד*Srv9.deff: ^[h,k,m] ## קבציh*.*,k*.*ו-m*.*
בהשוואת קבצים, אתה יכול להשתמש במסנני שורות כדי להתעלם משורות בודדות. לדוגמה, אתה עשוי להשתמש במסנני שורות כדי להתעלם מהערות או מסוג קוד שנוצר מסוים, כמו חותמות זמן של מערכת בקרת גרסאות. כל מסנן שורות הוא כלל, ואתה יכול להחיל כל מספר של מסנני שורות על השוואת קבצים.
כדי ללמוד כיצד להוסיף, לערוך ולנהל מסננים, ראה סעיף 5, “שימוש בתיבת הדו-שיח מסננים”.
אתה יכול להחיל מסנני שורות באמצעות אחת מהשיטות הבאות:
כשאתה מפעיל השוואת קבצים מתיבת הדו-שיח בחר קבצים או תיקיות
לאחר בחירת הקבצים 1 ו-2, לחץ על ליד השדה מסנן.
בתיבת הדו-שיח מסננים, השתמש בכרטיסייה מסנני שורות כדי להפעיל את מסנני השורות שבהם ברצונך להשתמש (אם יש), או כדי לראות אילו מסנני שורות מופעלים כעת.
השדה מסנן לא מציין אילו מסנני שורות מופעלים.
המשך בפעולת השוואת הקבצים. מסנני השורות המופעלים מוחלים כשאתה מתחיל את הפעולה.
לאחר שכבר הפעלת פעולת השוואת קבצים (לדוגמה, כדי להחיל מסננים שונים או להשבית סינון)
לחץ על → .
פתח את הכרטיסייה מסנני קבצים.
סמן את מסנני השורות הבודדים שברצונך להחיל ובטל את הסימון של מסננים שאינך רוצה להחיל.
אתה יכול גם להוסיף, לערוך ולהסיר מסננים מהרשימה באמצעות הכפתורים , ו-.
כדי להפעיל סינון שורות, סמן את אפשר מסנני שורות. כדי לכבות סינון שורות, בטל את הסימון של האפשרות.
לחץ על כדי לסגור את תיבת הדו-שיח מסנני קבצים.
לחץ על F5 כדי להחיל את השינויים שלך ולרענן את חלון השוואת הקבצים.
מסנן שורות הוא כלל המוערך כנגד כל הבדל בשורה בודדת בקבצים המושווים שלך, אם כללי מסנן שורות מופעלים. כאשר כלל תואם להבדל בשורה בודדת, ההבדל מתעלם ממנו.
הבדלים שמתעלמים מהם מסומנים בחלון השוואת הקבצים בצבע הבדל שמתעלמים ממנו (כפי שהוגדר בדף צבעים של אפשרויות WinMerge). זה מאפשר לך להבחין בין הבדלים שמתעלמים מהם מסוגים אחרים. עם זאת, אינך יכול לבחור או למזג הבדל שמתעלמים ממנו.
התאמת מסנן שורות ניתנת לתיאור במונחים של שני רעיונות:
כאשר כלל תואם לכל חלק מהשורה, ההבדל כולו מתעלמים ממנו. לכן, אינך יכול לסנן רק חלק משורה. לדוגמה, נניח שלשני קבצים יש את ההבדל הבא בשורה בודדת:
קובץ 1:
# Jean Sibelius
קובץ 2:
# Janne Sibelius
ללא סינון, השורה מזוהה כהבדל. אבל אם נחיל כלל מסנן שורות עם הביטוי,
^#, השורות מדווחות כזהות, מכיוון שהביטוי מציין רק את התו
הראשון, התואם בשני הקבצים.
כלל מוחל על הבדל מרובה שורות רק אם כל השורות תואמות. לדוגמה, שקול את ההבדל הזה בשתי שורות:
קובץ 1:
# Jean Sibelius # Pekka Himanen
קובץ 2:
# Janne Sibelius Pekka Himanen
אותו כלל ^# תואם לשורה הראשונה, אך לא לשורה השנייה. לכן, לא
מתעלמים מההבדל.
בדרך כלל מומלץ להשתמש בסמן תחילת שורה ( ^ ) וסוף שורה (
$ ) כדי לשלוט בדפוסים שלך במדויק, מכיוון שהכלל מוחל אם כל חלק
משורה תואם לביטוי.
דוגמה 7. מסנני שורות לדוגמה
^MYTAG$
מסנן שורות שתואמות בדיוק ל-MYTAG
^::
מסנן שורות שמתחילות ב-::
^/\*.*\*/$
מסנן שורות שמתחילות ב- ומסתיימות
ב-/**/
^[1-5]00
מסנן שורות שמתחילות במספרים 100, 200, 300, 400 ו-500
דוגמה 8. כלל מסנן שורות התואם לשורות CVS Id
שורות CVS Id נראות כך:
// $Id: Filters.xml 7591 2013-01-20 15:47:42Z christianlist $
... וניתן לסנן עם כלל זה:
^// \WId: .*\$
דוגמה 9. סנן הערות מספרי שורות בקבצי po
הערות מספרי שורות של po נראות כך:
#: src/filename.c:766
... וניתן לסנן עם כלל זה:
^#
סעיף זה מתאר את תיבת הדו-שיח מסננים, המספקת פונקציות ליצירה וניהול של מסנני קבצים ומסנני שורות.
כדי לפתוח את תיבת הדו-שיח מסננים, השתמש באחת מהשיטות הבאות:
בתיבת הדו-שיח בחר קבצים או תיקיות, לחץ על מימין לשדה מסנן. אתה משתמש בשיטה זו כשאתה רוצה להחיל מסנן קבצים על פעולת השוואת תיקיות.
לחץ על → . ניתן להשתמש בשיטה זו בכל עת, למעט כאשר תיבת הדו-שיח בחר קבצים או תיקיות פתוחה.
בתיבת הדו-שיח מסננים יש כרטיסייה לכל סוג של מסנן WinMerge:
בחר כרטיסייה זו כדי לעבוד עם מסנני קבצים עבור פעולות השוואת תיקיות.
בחר כרטיסייה זו כדי לעבוד עם מסנני שורות עבור פעולות השוואת קבצים.
בחר כרטיסייה זו כדי לעבוד עם מסנני החלפה עבור פעולות השוואת קבצים.
החלק העיקרי של כרטיסייה זו הוא רשימה של מסנני קבצים הזמינים עבור פעולות השוואת תיקיות. הרשימה כוללת מסנני קבצים משותפים, פרטיים ומוגדרים ש-WinMerge מכיר, כמתואר ב-סעיף 2.1, “מיקומי מסנני קבצים”.
עליך להפעיל מסנן קבצים כדי להפוך אותו לזמין בפעולת השוואת תיקיות, או להשבית מסנן נוכחי כדי למנוע את השימוש בו:
פתח את תיבת הדו-שיח מסננים, אם היא עדיין לא פתוחה.
בחר מסנן קבצים או מהרשימה.
לחץ על כדי לסגור את תיבת הדו-שיח מסננים.
ישנן מספר דרכים להחיל מסנני קבצים לאחר הפעלתם. לפרטים, ראה סעיף 2.2, “החלת מסנני קבצים”.
השתמש בלחצנים אלה כדי לנהל את רשימת מסנני קבצים שלך וליצור מסנני קבצים חדשים:
בחר מסנן קבצים ברשימה ולחץ על כדי לראות במהירות כיצד המסנן עובד. ראה סעיף 5.1.4, “בדיקת כללי מסנן קבצים” לפרטים.
מאפשר לך לאתר מסנן קבצים ומוסיף אותו לרשימת המסננים. מסנני קבצים שאינם בתיקייה המשותפת או הפרטית המוגדרת כברירת מחדל אינם מזוהים אלא אם אתה מתקין אותם.
יוצר עותק חדש של תבנית קבצים בתיקיות המסננים המשותפות או הפרטיות, ופותח אותו בעורך ברירת המחדל שלך. ערוך את התבנית והוסף את הכללים שלך, כמתואר ב-סעיף 5.1.3, “יצירת מסנן קבצים”.
בחר מסנן קבצים ברשימה ולחץ על כדי לפתוח את הקובץ בעורך ברירת המחדל שלך.
בחר מסנן קבצים ברשימה ולחץ על כדי למחוק את הקובץ ולהסיר אותו מהרשימה. כן, הקובץ באמת נמחק!
השינויים שלך נשמרים כשאתה לוחץ על כדי לסגור את תיבת הדו-שיח מסננים. מסנני שורות מאוחסנים ברישום של Windows.
אם מסנני הקבצים המותקנים עם WinMerge אינם מספקים את הסינון הדרוש לך, אתה יכול ליצור מסננים משלך:
לחץ על → . או, מתיבת הדו-שיח בחר קבצים או תיקיות, לחץ על מימין לשדה מסנן.
בתיבת הדו-שיח מסנן משותף או פרטי, בחר מסנן משותף או מסנן פרטי (ראה סעיף 2.1, “מיקומי מסנני קבצים” לשימושים בהם) ולחץ על אישור.
תיבת הדו-שיח בחר שם קובץ למסנן חדש נפתחת בתיקיית הקבצים המשותפת או הפרטית במערכת שלך (אם התיקייה הפרטית אינה קיימת, WinMerge יוצר אותה).
בתיבת הדו-שיח בחר שם קובץ למסנן חדש, הזן שם קובץ חדש ולחץ על .
אל תבחר שם קובץ קיים: כדי לערוך קובץ קיים, חזור לשלב 2 ולחץ על ערוך במקום על חדש.
WinMerge מאתחל את הקובץ החדש עם התוכן של התבנית
FileFilter.tmpl, ופותח אותו בעורך הטקסט המוגדר כברירת
מחדל שלך.
פעל בהתאם להוראות התבנית כדי לערוך את התבנית, לעדכן את שם מציין המיקום והתיאור ולהוסיף כללי מסנן כמתואר ב-סעיף 2.3, “תחביר מסנן קבצים”. שמור את הקובץ בעורך הטקסט שלך.
אם אתה רוצה לבדוק במהירות כלל שאתה מגדיר, נסה ללחוץ על בדוק בתיבת הדו-שיח מסננים. ראה סעיף 5.1.4, “בדיקת כללי מסנן קבצים” לפרטים.
אם יצרת את מסנן הקבצים שלך באחת מתיקיות מסננים
הסטנדרטיות, ותיבת הדו-שיח מסננים אינה מציגה את מסנן הקבצים החדש שלך, נסה
ללחוץ על כדי לסגור אותה, ואז לחץ על
→ שוב כדי לפתוח אותה מחדש. רשימת מסנני
קבצים צריכה לכלול כעת את מסנן הקבצים החדש.
אם שמרת את הקובץ במיקום חלופי במערכת הקבצים שלך), WinMerge לא יכול לזהות אותו אלא אם אתה מתקין אותו. כדי להפוך מסנן קבצים לניתן לזיהוי בכל מקום במערכת שלך:
לחץ על בתיבת הדו-שיח מסננים.
בתיבת הדו-שיח אתר קובץ מסנן להתקנה, נווט לקובץ flt
במערכת שלך ולחץ על . רשימת מסנני הקבצים צריכה
לכלול כעת את מסנן הקבצים המותקן.
השתמש בתיבת הדו-שיח בדוק מסנן כדי לבדוק במהירות מסנן קבצים כנגד נתוני דוגמה, כדי לעזור לך לפתח כללים חדשים או כדי להבין כיצד כללים קיימים עובדים. זה יכול להיות קל יותר מאשר הפעלת פעולת השוואה מלאה.
החל מתיבת הדו-שיח מסננים:
בכרטיסייה מסנני קבצים, בחר את מסנן הקבצים שברצונך לבדוק.
אם אתה רוצה לראות את הכללים שאתה הולך לבדוק, לחץ על עכשיו כדי לפתוח את הקובץ כדי שתוכל לצפות בו במהלך השלבים הבאים.
לחץ על .
בתיבת הדו-שיח בדוק מסנן, בחר את סוג הכלל לבדיקה:
כדי לבדוק כלל קובץ f: במסנן הקבצים שלך, בטל את הסימון של האפשרות שם תיקייה.
כדי לבדוק כלל תיקייה d:, סמן את האפשרות שם תיקייה.
הזן את הטקסט לבדיקה.
הטקסט צריך להיות מתאים לסוג הכלל שאתה בודק. לדוגמה, אם סימנת את האפשרות שם תיקייה, סביר להניח שתרצה להזין שם תיקייה, כגון \temp.
התיבה תוצאה מציגה את הערך שהזנת, ואחריו את הסטטוס שלו:
עבר או
נכשל.
השתמש בכרטיסייה זו כדי להגדיר ולהפעיל מסנני שורות עבור פעולות השוואת קבצים. הכרטיסייה כוללת רשימה של כללים. כל כלל מכיל ביטוי רגולרי יחיד. אתה יכול להחיל כל שילוב של כללים מהרשימה על השוואת קבצים.
מתחת לרשימת ביטויים רגולריים יש תיבת עריכה ולחצנים שבהם תוכל להשתמש כדי לתחזק את הרשימה בכל עת על ידי הוספה, עריכה והסרה של כללים.
כדי להוסיף כלל חדש:
לחץ על . סמן העריכה שלך מופעל אוטומטית בתיבת העריכה.
הזן ביטוי בתיבת העריכה שמתחת לרשימת ביטויים רגולריים.
לחץ על כדי לטעון את הביטוי בשורה חדשה ברשימה.
כדי לערוך כלל קיים:
בחר את השורה ולחץ על .
ערוך את הביטוי בתיבת העריכה.
לחץ על כשסיימת.
כדי למחוק כלל קיים, בחר (סמן) את הכלל ולחץ על .
ברשימת ביטויים רגולריים, סמן רק את המסננים שברצונך להחיל ובטל את הסימון של כל המסננים שאינך רוצה להחיל.
סמן או בטל את הסימון של האפשרות אפשר מסנני שורות. אם תפעיל סינון, כל הכללים המסומנים כעת ברשימת ביטוי רגולרי ישמשו. אם הסינון כבוי, לא ישמשו כללים גם אם הם מסומנים.
לחץ על כדי לסגור את תיבת הדו-שיח מסננים ולשמור את ההגדרות שלך.
ישנן מספר דרכים להחיל מסנני קבצים לאחר הפעלתם. לפרטים, ראה סעיף 3.1, “החלת מסנני שורות”.
ביטויים רגולריים יכולים להיות מורכבים מאוד. למרבה המזל, רוב מסנני הקבצים ב-WinMerge כוללים ביטויי סיומת פשוטים, כפי שמוצג בדוגמאות בנושא זה. קבצי המסנן המותקנים עם WinMerge כוללים דוגמאות שימושיות רבות אחרות.
לבסוף, ישנם משאבים רבים באינטרנט לעזרה ב-regexps, כולל אתרים אלה: