home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / utils / bug / 2012 < prev    next >
Encoding:
Text File  |  1992-11-08  |  1.4 KB  |  42 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!bothner
  3. From: bothner@cygnus.com
  4. Subject: Re: REGEX: "re_might_match()" possible ? (NO BUG)
  5. Message-ID: <9211080310.AA27933@cygnus.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. References: <199211061348.AA27125@bredex.de>
  9. Distribution: gnu
  10. Date: Sat, 7 Nov 1992 11:10:33 GMT
  11. Approved: bug-gnu-utils@prep.ai.mit.edu
  12. Lines: 28
  13.  
  14. > We need a function to see if input MIGHT match.
  15. > Which means, we would like to check if a string matches
  16. > NOT AFTER typing in the whole string, BUT MEANWHILE
  17. > the user is typing.
  18.  
  19. I hacked GNU regex to support something like that.
  20. Basically, there is a special error code indicating that
  21. the match failed because there wasn't enough input (we reach
  22. end fo the input string).
  23.  
  24. I used this to efficiently implement a multi-level glob:
  25. I wanted to have
  26.     echo PATTERN
  27. act as if it were:
  28.     echo `find . -print|ggrep PATTERN`
  29. (where ggrep would use extended ksh-style globbing syntax for regexes).
  30.  
  31. The regex extension is to avoid expanding useless directories
  32. (ones that could not match the pattern).
  33.  
  34. The same relatively simple modification to regex could work
  35. for your problem.   My code is part of the Q language
  36. (pub/Q.tar.Z on cygnus.com); I can mail my heavily-hacked
  37. regex separately, if you want.
  38.  
  39.     --Per Bothner
  40. Cygnus Support     bothner@cygnus.com
  41.  
  42.