home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7469 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.6 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!decwrl!autodesk!dansmith
  2. From: dansmith@Autodesk.COM (Daniel Smith)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Perl-side globbing (was Re: Perl Shell...)
  5. Message-ID: <18153@autodesk.COM>
  6. Date: 16 Dec 92 23:26:08 GMT
  7. References: <18086@autodesk.COM> <1992Dec10.073900.16503@spillman.uucp> <BzBvo6.96G@sran230.sra.co.jp>
  8. Organization: Autodesk Inc., Sausalito CA, USA
  9. Lines: 28
  10.  
  11. In <BzBvo6.96G@sran230.sra.co.jp> utashiro@sran230.sra.co.jp (Kazumasa Utashiro) writes:
  12.  
  13. > For your interest, here is my shell wildcard to regexp
  14. > subroutine.  This version works only for a filename (not a
  15. > path).  I wonder you call this simple or complex :-)
  16.  
  17. > sub wildcard {
  18. >     local($_) = @_;
  19. >     s#\\?.#$_ = $&; s/\\?([_0-9A-Za-z])/$1/ || /\\./ || s/[*]/.*/ ||
  20. >     s/[|]/\$|^/ || tr/?{,}[]\-/.(|)[]\-/ || s/./\\$&/; $_;#ge;
  21. >     length($_) ? "^$_\$" : undef;
  22. > }
  23.  
  24.     Geez! :-)  I suppose a good thing I can point out about the shell
  25. that I posted is that it's good for interactively working out lines like
  26. that above (or did you get that one right the first time? [1])  I can have
  27. it running in one window, and bounce perlisms off of it, while working through
  28. a script in another...  Thanks to the folks that sent me globbing ideas/code,
  29. I hope to integrate them into SoftList, making it a lot more useable.
  30.  
  31.                 Daniel
  32.  
  33. [1] if so, I bow and wave, and say "I'm not worthy!" a la Wayne's World
  34. -- 
  35.      Daniel Smith, Autodesk, Sausalito, California, (415) 332-2344 x 2580
  36.           Disclaimer: written by a highly caffeinated mammal
  37.         dansmith@autodesk.com            dansmith@well.sf.ca.us
  38.  
  39.