NetEZ.com NetEZ Community
Enter City & State or US Zip Code:
Change your local weather options
Google
WWW NetEZ.com

NetEZ.com Forum Index  
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tips and Tricks #1 - Wildcards and filters

 
Post new topic   Reply to topic    NetEZ.com Forum Index -> x2 / 2X General
View previous topic :: View next topic  
Author Message
nikos
Moderator
Moderator


Joined: 07 Feb 2002
Posts: 12346
Location: UK

PostPosted: Wed Feb 20, 2002 10:20 am    Post subject: Reply with quote

One of the sweetest things offered by 2xExplorer are these little things called wildcards (also known as filters, templates etc). Wildcards are shorthands for matching a range of strings or names. They are used all over the place in 2x, e.g. for selecting a subset of the files shown.

Wildcards are combinations of normal letters/numbers and two special characters, * and ?. The meaning of these two comes directly from the old command line (DOS) days:
* - matches zero or more characters
? - matches exactly one character

You can freely pick and mix these symbols in a wildcard, and have as many of them as you want. The simplest use is to match all the names with the same extension with a wildcard like *.txt. This means that we don't care about the base name (it can be "*", that is anything); we just need it to be followed by a dot '.' and the extension "txt", and that would be all if we wanted to select all the text files shown in a pane. Let's have a look at some more complicated examples:

a*.c?? - This will match any names beginning with 'a', and a three-letter extension beginning with a 'c'. Names like alpha.cxx, a.cpp and amen.cab will all be matched. On the other hand the following names won't be matched: beta.cpp (begins with 'b'), atest.c (doesn't have 3-letter extension), irrelevant.txt (has got no chance whatsoever :) )

?a*txt - This will match names whose second letter is 'a' and end-up in 'txt' (note that it doesn't have to be an extension since we didn't ask for a '.'). Here are a few matching names: ball.txt, aaa.dostxt, ratxt. And these won't match: atxt, aa.bak.

More complicated effects are achieved by combining two or more wildcards, separated by commas ','. For instance, if you want to see just the header and source files in your C++ project folder, just type in the address bar *.h, *.cpp .

If you want to obtain a PhD in wildcards, then you need to know about exclusion filters. These are combinations of two or more wildcards separated by commas as described above, but one or more of them are for exclusion, indicated by placing a minus '-' character in the beginning of the wildcard. So you could have oddities like *, -*.ncb, -*.aps which means "match all files except files with ncb or aps extensions".

Armed with this knowledge, you can now take better advantage of 2xExplorer features that use wildcards: (there is more than this)
<ul>
<li> Limit the files shown. Just type a wildcard in the address bar.
<li> Select or unselect files. To select only a few particular files out of those shown just type a wildcard in the Select/Unselect dialog (Mark menu). There are more options there to fine-tune what happens to the existing selection.
<li> Find command. A wildcard in the "Named" box will limit the number of files searched. This is especially useful if you are searching for contained text and you know e.g. the extension of the file.
</ul>

Successful graduates of this course won't have a problem solving a little puzzle, and figure out which of the following names match the wildcard ?a??*.*?xl, -*.txt, -*

bark.xl
bark.xxl
barking.myxl
aardvark.txt
man.opxl
ante.cpp
impossible.gzip

Is this a trick question or what? ;)
(no need to post answers to the forum!)
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    NetEZ.com Forum Index -> x2 / 2X General All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP