Category : Printer + Display Graphics
Archive   : DISP160.ZIP
Filename : MATCH.DOC

 
Output of file : MATCH.DOC contained in archive : DISP160.ZIP

REGEX Globber (Wild Card Matching)

A *IX SH style pattern matcher written in C
V1.10 Dedicated to the Public Domain

March 12, 1991
J. Kercheval
[72450,3702] -- [email protected]




*IX SH style Regular Expressions
================================

The *IX command SH is a working shell similar in feel to the MSDOS
shell COMMAND.COM. In point of fact much of what we see in our
familiar DOS PROMPT was gleaned from the early UNIX shells available
for many of machines the people involved in the computing arena had
at the time of the development of DOS and it's much maligned
precursor CP/M (although the UNIX shells were and are much more
flexible and powerful then those on the current flock of micro
machines). The designers of DOS and CP/M did some fairly strange
things with their command processor and OS. One of those things was
to only selectively adopt the regular expressions allowed within the
*IX shells. Only '?' and '*' were allowed in filenames and even with
these the '*' was allowed only at the end of a pattern and in fact
when used to specify the filename the '*' did not apply to extension.
This gave rise to the all too common expression "*.*".

REGEX Globber is a SH pattern matcher. This allows such
specifications as *75.zip or * (equivelant to *.* in DOS lingo).
Expressions such as [a-e]*t would fit the name "apple.crt" or
"catspaw.bat" or "elegant". This allows considerably wider
flexibility in file specification, general parsing or any other
circumstance in which this type of pattern matching is wanted.

A match would mean that the entire string TEXT is used up in matching
the PATTERN and conversely the matched TEXT uses up the entire
PATTERN.

In the specified pattern string:
`*' matches any sequence of characters (zero or more)
`?' matches any character
`\' suppresses syntactic significance of a special character
[SET] matches any character in the specified set,
[!SET] or [^SET] matches any character not in the specified set.

A set is composed of characters or ranges; a range looks like
'character hyphen character' (as in 0-9 or A-Z). [0-9a-zA-Z_] is the
minimal set of characters allowed in the [..] pattern construct.
Other characters are allowed (ie. 8 bit characters) if your system
will support them (it almost certainly will).

To suppress the special syntactic significance of any of `[]*?!^-\',
and match the character exactly, precede it with a `\'.



  3 Responses to “Category : Printer + Display Graphics
Archive   : DISP160.ZIP
Filename : MATCH.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/