The Advanced Search Feature of WinBackup is based on Regular Expressions. This functionality allows you to make more flexible, detailed and specific searches when trying to locate the files that you want to backup.

 

In general, you would type your search expression in the Search Window on the Side Panel.

 

 

The search results appear as a separate folder in the work area and you can browse around selecting and un-selecting files in the same manner as you would when selecting files for backup and restore.

 

 

The bottom half of the User Interface, also contains the Search Status.

 

 

Since WinBackup must search through several folders and hundreds if not thousands of files on your hard drive/s and other storage media, you may experience some delays.  The more complex the expressions, the longer WinBackup may take as it has to sift through files individually to return exact matches to your search expressions. Do not shut down WinBackup.

 

When performing searches WinBackup may take long to find all the specified files. DO NOT shut down WinBackup while these searches may be performed. WinBackup may seem inactive however it is matching your search criteria.

 

 

It is important to note that this help topic is meant to give you a brief overview of some of the more common regular expressions and the syntax used in WinBackup.  There are hundreds of online resources that explain regular expressions in greater depth.

 

The following is a list of contents in this Help Topic

 

What Are Regular Expressions?

Expressions are combination of symbols that represent a value.  These expressions are used in programming, in databases and in spreadsheets.  In databases (and searches), you use expressions to define what information you would like to application to return.  These expressions or queries are classified by the type of value they represent.  Boolean expressions (used in search engines) evaluate to either TRUE or FALSE. Integer expressions evaluate to whole numbers like 5 and 78 while String expressions evaluate to character strings.  

 

Regular Expressions On the Internet, you will usually find the name abbreviated to "regex" or "regexp". are a powerful and complex form of combined Boolean and string expressions that have their own specific syntax that you would need to follow. Basically, a regular expression is a pattern describing a certain amount of text be it letters (e.g., "a"), symbols and characters (e.g., "@") or numerals (e.g., "1").  WinBackup will match the text you are looking for and return the results in the same way it does for Windows-type Searches.  Unlike search engine expressions that are simple Boolean expressions, regular expressions can go down to very minute details to return full (by default) or partial (through combining a series of characters) matches to what you are looking for.  

 

Regular Expression Syntax

Regular expression patterns are specified as strings containing a mix of text and special character sequences.

 

The search   abc returns or matches all the files that are three characters long, that are called "abc"  and that have no file extension

 

In WinBackup regular expressions may be used to leverage their power to find very specific items.  For example, the string   .*[0-9]+.txt  returns or matches all the text files (.txt extension) that have any letter and symbol and any of the numbers between 0 and 9 found anywhere in the filename.  Log files, for example, are written as text files and you may want to backup up the logs relating to all or any of the applications and/or that you have running on your system.  This simple regular enables you to look for these logs wherever they may be.   A standard search for *.txt will return the same match, however, the power of regular expressions is in the greater level of detail and specificity you can search for.

 

Using the correct syntax will allow you to specify the rules for the set of possible strings that you want WinBackup to match - you will be able to look for sentences, or email addresses, or text strings say between 'a' to 'z', or anything you like.  

 

By default WinBackup will search using Windows Style syntax.  To tell WinBackup that you will be using regular expressions, please type the hash or pound sign # before your regular expression.  

 

Leave no spaces between # and your regular expression.

 

You must also specify the directory or folder location to perform such searches.

 

 

 

 

The screenshot above returns the specified search.  The search results or matches appear as a folder under the Backup Sources () in the WinBackup Interface - this greatly facilitates selecting matched files for backup.  Select all the search results just by clicking on the box that is under the Search Results icon ().   The right hand side of the screen shows all the matches found by WinBackup.  

 

Regular expressions can be created to make the searches more specific. For example, if you would like to look for your digital camera pics but cannot remember where you placed them (or they are located in several folders on your hard drive, you may write the following search expression preceded by the hash or pound sign #:

 

PICT[0-9]{3}.jpg

 

Digital cameras usually store filenames starting with the uppercase letters "PICT" followed by three numbers.   The files are stored as jpg (file extension).  In essence, you are telling WinBackup to look for all files starting with "PICT".  You are also telling WinBackup to match only files within these combinations that have any 3 digit number and that end specifically with the extension jpg.  Unlike the Windows-style Search expression PICT*.jpg which looks for and matches all jpg files that contain the prefix PICT, the WinBackup Advanced Search Feature allows you to be extremely specific.  So if you have a file that is called "pict.jpg" or "MYpict.jpg" or "pict001a.jpg", these will NOT be matched.  A Windows-style search would return "pict.jpg" and "pict001a.jpg" with your results.  

 

 

 

Literal Characters

The most basic regular expression consists of a single literal character, for example, "a". All characters are literal except: ".", "|", "*", "?", "+", "(", ")", "{", "}", "[", "]", "^", "$" and "\". To make these characters literal, type in "\" before.  So \\ makes a literal backslash.  Any character that is not a special character matches itself.

 

 

 

Special Characters

WinBackup allows you to use regular expressions using more than simple text searches.  By creating special character sequences or combinations you can search for a multitude of files that are spread across your system.  The following are the special characters you would need to know for WinBackup:

 

Character

Description

^

Anchors to the beginning of the string. The expression "^A" will match an A only at the beginning of the string.

^

The caret ^ immediately following the left-bracket ([) has a different meaning. It is used to exclude the remaining characters within brackets from matching the target string. The expression "[^0-9]" indicates that the target character should not be a digit.

$

The dollar sign $ will match the end of the string. The expression "abc$" will match the sub-string "abc" only if it is at the end of the string.

|

The alternation character | or pipe allows either expression on its side to match the target string. The expression "a|b" will match a as well as b.  In other words, the OR character | allows a choice between two regular expressions. For example, jell(y|ies) matches either "jelly" or "jellies".

.

The dot . will match any character.

*

The asterisk * indicates that the character to the left of the asterisk in the expression should match 0 or more times. A one-character regular expression or grouped sub-expressions followed by an asterisk * matches zero or more occurrences of the regular expression. For example, [a-z]* matches zero or more lowercase characters.

+

The plus + is similar to asterisk but there should be at least one match of the character to the left of the + sign in the expression.

?

The question mark ? matches the character to its left 0 or 1 times.

( )

Parentheses group parts of regular expressions together into grouped sub-expressions that can be treated as a single unit. For example, "(ha)+" matches one or more instances of "ha".

[ ]

Brackets [ and ] enclosing a set of characters indicates that any of the enclosed characters may match the target character.

{ }

Braces { } are used to indicate a range of occurrences of a regular expression, in the form {a, b} where a is a positive integer equal to or greater than zero indicating the start of the range and b is equal to or greater than a, indicating the end of the range. For example, "(ba){0,3}" matches up to three pairs of the expression "ba".

 

 

 

To make these characters literal, type in "\" before.

 

 

Character Classes or Character Sets

With a "character class" or "character set", you can tell WinBackup to match only one out of several characters. Place the characters you want to match between square brackets "[" and "]".  Sets can contain literals and character ranges among others.  

 

Example 1 - Character Literals

 

 

Expression

Description

[xyz]

will match either of "x", "y", or "z". This means that WinBackup will return or match all files that have one letter as a filename starting with the letters "x" or "y" or "z" and that have no file extension.

[^xyz]

will match any character other than "x", "y", or "z".

.*[xyz].*

will match either of "x", "y", or "z" occurring anywhere in the filename. This means that WinBackup will match all those files that have "x" or "y" or "z" occurring anywhere in the filename and that have no file extension. This is equivalent to combining the three separate standard search expressions *x*, *y*  and *z*.

.*[xyz].*\.doc

will match either of "x", "y", or "z" occurring anywhere in the filename with a specific file extension. This means that WinBackup will return or match all files that have "x" or "y" or "z" occurring anywhere in the filename and that have the "doc" file extension.

 

 

 

 

Example 2 - Character Ranges

 

 

Expression

Description

[a-z]

will match any character in the range "a" to "z" in lower case. This means that WinBackup will return or match all files that have one letter as a filename and that have no file extension.

[a-zA-Z]  

will match any character in the range "a" to "z" in lower and uppercase. This means that WinBackup will return or match all files that have one letter as a filename and that have no file extension.

[a-z]*

will match filenames consisting only of the characters "a" to "z" in lower case occurring anywhere in the filename, for example aq, br, lmj but would exclude wu8a.

[a-z]*\.doc

 

will match filenames consisting of any character in the range "a" to "z" in lower case with a specific file extension. The "\." specifies that WinBackup should treat the "." as a literal character and thus match only Word documents.

[a-z]*\.(doc|xls)

will match filenames consisting of any character in the range "a" to "z" in lower case with two specific file extensions. The "\." specifies that WinBackup should treat the "." as a literal character and thus match only Word or Excel documents.  The pipe character "|" denotes "or" while the ( ) tell WinBackup to match these extensions exactly.  If you would like to look for Word Templates as well, you will rewrite the expression as follows

[a-z]*\.(do[ct]|xls)

[0-9]

will match any character in the range "0" to "9".

 

[a-z0-9]

will match any character in the ranges "a" to "z" in lower case and "0" to "9". This means that WinBackup will return or match all files that have one letter or number as a filename and that have no file extension.

  

[^A-Z]

will match any character other than those in the range "A" to "Z" in upper case.

 

 

 

 

In reality such expressions are extremely important.  For example, you may have misspelt a filename or certain file names may contain letters that are interchangeable due to differences in language, say differences in spelling by the Americans and the British as is the case between licenSe and licenCe.  Hence, if you are looking for a specific license agreement, for example, that you know you stored as a doc, your search expression may be licen[sc]e.doc. WinBackup will match all the doc files that contain the letters in the exact "licen" combination with a 6th letter that may be an "s" or a "c" and that ends with "e".

 

All regular expressions can be made case-insensitive by substituting individual characters with character sets, for example, [Cc][Aa][Tt].  

 

The concatenation of regular expressions creates a regular expression that matches the corresponding concatenation of strings. For example, [A-Za-z]* matches any capitalized word.

 

 

What's Next?

Shortcuts

 

Related Topics