home *** CD-ROM | disk | FTP | other *** search
- 02-20-91 Seattle, WA
-
-
- Here is a *IX wildcard globber I butchered, hacked and cajoled together
- after seeing and hearing about and becoming disgusted with several similar
- routines which had one or more of the following attributes: slow, buggy,
- required large levels of recursion on matches, required grotesque levels
- of recursion on failing matches using '*', full of caveats about usability
- or copyrights.
-
- I submit this without copyright and with the clear understanding that
- this code may be used by anyone, for any reason, with any modifications
- and without any guarantees, warrantee or statements of usability of any
- sort.
-
- Having gotten those cow chips out of the way, these routines are fairly
- well tested and reasonably fast. I have made an effort to fail on all
- bad patterns and to quickly determine failing '*' patterns. This parser
- will also do quite a bit of the '*' matching via quick linear loops versus
- the standard blind recursive descent.
-
- This parser has been submitted to profilers at various stages of development
- and has come through quite well. If the last millisecond is important to
- you then some time can be shaved by using stack allocated variables in
- place of many of the pointer follows (which may be done fairly often) found
- in regex_match and regex_match_after_star (ie *p, *t).
-
- No attempt is made to provide general [pat,pat] comparisons. The specific
- subcases supplied by these routines is [pat,text] which is sufficient
- for the large majority of cases (should you care).
-
- Since regex_match may return one of three different values depending upon
- the pattern and text I have made a simple shell for convenience (match()).
- Also included is an is_pattern routine to quickly check a potential pattern
- for regex special characters. I even placed this all in a header file for
- you lazy folks!
-
- Having said all that, here is my own reinvention of the wheel. Please
- enjoy it's use and I hope it is of some help to those with need ....
-
-
- jbk
-
- From: johnk@wrq.com
- Date: 22 Feb 91 01:15:43 GMT
- Organization: Walker Richer & Quinn, Inc., Seattle, WA
-
- John Kercheval -- 127 NW Bowdion Pl #105 -- Seattle, WA 98107-4960
- Home(Voice): (206) 547-4676 -------- Work (Voice): (206) 324-0350
-