Boost logo

Boost :

From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-03-28 08:59:38


From: Dylan Nicholson [mailto:dylan_nicholson_at_[hidden]]
>
> Definitely much neater without all the long function names.

Agree.

> I would expect move() and copy() to be able to take a file
> name for the source
> and a directory name for the destination, and in this case
> move/copy the file
> to the specified directory.

Agree.

> I'm not sure I'm too keen on using regular expressions for
> finding files, as
> neither Windows or POSIX use these. POSIX allows
>
> * = any number of any characters
> ? = any character
> [...] = as per regex but using ! instead of ^
>
> Also '/' can be used anywhere in the pattern to match across
> directories.
> For instance */* will return the names of all entries in all
> directories
> directly under the initial directory.
>
> Furthermore any leading . must be matched explicitly. There
> is in fact no
> pattern that will find *all* files/directories (including . and ..).
>
> Windows is much the same except [...] isn't supported,
> leading .'s don't get
> special treatment and *.* is the same as '*'. Both / and \
> are treated as path
> separators, but you can only use wildcards after the last
> separator (*\* is not
> legal, but mypath\* is).

In your own explanation, you show how two different OSes do it differently.
Other OSes probably have other rules. Some may offer no such pattern
matching rules. On Unix, the globbing is controlled by the shell, so there
is no standard other than the de facto standard created by the Bourne Shell
that most others follow to one degree or another. However, bash augments it
with {} which can be used to specify something between alternation and sets.
For example, {abc,pdq,xyz} means substitute each of abc, pdq, and xyz in
that part of the pattern when looking for matches.

Since there is no standard to follow, regular expressions are a great
equalizer and are more powerful to boot. I can't see any reason not to
prefer REs for this task.

Rob
Susquehanna International Group, LLP
http://www.sig.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk