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

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!ogicse!reed!mjeffery
  2. From: mjeffery@reed.edu (Mark Jefferys)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: In 5.0, are we gonna get...
  5. Message-ID: <1992Dec15.053156.1836@reed.edu>
  6. Date: 15 Dec 92 05:31:56 GMT
  7. Article-I.D.: reed.1992Dec15.053156.1836
  8. References: <1992Dec14.043835.23009@reed.edu> <1992Dec14.192007.7534@wdl.loral.com>
  9. Organization: Reed College, Portland, OR
  10. Lines: 38
  11.  
  12. In article <1992Dec14.192007.7534@wdl.loral.com> mab@wdl39.wdl.loral.com (Mark A Biggar) writes:
  13. % In article <1992Dec14.043835.23009@reed.edu> mjeffery@reed.edu (Mark Jefferys) writes:
  14.  
  15. % >    map(/(\d+)/, "asdf 23fjk4", "qwerty", "123 ")
  16.                   ^ forgot the `g'
  17.  
  18. % >   would return ("23", "4", "123").
  19.  
  20. % Easily constructed using grep:
  21. %         grep((/(\d+)/,$_=$1), "asdf 23jfk4", "qwerty", "123 ")
  22.  
  23. This seems to fail badly on my perl -- besides, it destroys the list,
  24. which I don't want it to do.
  25.  
  26. % >2) a way of only matching the real beginning/end of a *string* in a
  27. % >   regexp?  Currently, '^' and '$' match the beginning and ending of
  28. % >   a line (with simplifying assumptions when $* == 0).  A string match
  29. % >   would ignore newlines and $*.
  30. % >
  31. % >   A new option on pattern matches might do it:  `/^\d+$/s' might match
  32. % >   "23", but not "23\n" or "x\n45".  The option should treat `.' as
  33. % >   matching "\n", as well as every other character -- so the option
  34. % >   means that "\n" should not be treated specially. 
  35. % I believe that ^ at the beginning of a pattern will only match the beginning
  36. % of a string and $ at the end only the end, $* has effect only on embedded
  37. % ^ and $ in the middle of a pattern.
  38.  
  39. No.  ^ matches the beginning of a string or right after a newline, and
  40. $ matches the end of string or right before a newline.  When $* is 0,
  41. perl assumes that a newline only occurs at the last character of the
  42. string.
  43.  
  44.  
  45. Mark
  46. -- 
  47. Mark Jefferys        Internet: mjeffery@reed.edu
  48.