home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5703 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  1.2 KB

  1. Path: sparky!uunet!icd.ab.com!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Punctuation in Regex, or Wouldn't a \p be nice?
  5. Message-ID: <1992Sep3.182254.12438@netlabs.com>
  6. Date: 3 Sep 92 18:22:54 GMT
  7. References: <1992Sep2.232753.3020@cs.unca.edu>
  8. Sender: news@netlabs.com
  9. Organization: NetLabs, Inc.
  10. Lines: 16
  11. Nntp-Posting-Host: scalpel.netlabs.com
  12.  
  13. In article <1992Sep2.232753.3020@cs.unca.edu> mcmahan@cs.unca.edu (Scott McMahan -- Genesis mailing list owner) writes:
  14. : A really nice thing for perl to do would be to provide \p as a
  15. : regular expression like \s that would match one punctuation
  16. : character. (!@#$%^&*()_-+=~`}]{[|\"':;?/>.<, :^))
  17. : Since most of these are also regular expression characters, it
  18. : would eliminate a lot of \-ing.
  19. : Is there an easy way to put a lot of punctuation in a regex
  20. : without tons of quoting?  (q and qq don't look like they'd work)
  21.  
  22. It looks like [^\w\s] would be pretty close to what you want.  Note
  23. also that, within [], only @$-]\ (and whatever your pattern delimiter is)
  24. need to be backwhacked.  The others, .[{}*+?|(), are not special inside [].
  25.  
  26. Larry
  27.