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

  1. Path: sparky!uunet!eiffel!eiffel.com
  2. From: ram@eiffel.com (Raphael Manfredi)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Using $*, but pattern doesn't match
  5. Message-ID: <120@eiffel.eiffel.com>
  6. Date: 25 Aug 92 20:40:14 GMT
  7. References: <1992Aug25.181818.13613@advtech.uswest.com>
  8. Sender: ram@eiffel.com
  9. Organization: Interactive Software Engineering, Santa Barbara CA
  10. Lines: 22
  11.  
  12. Quoting rray@lookout.it.uswc.uswest.com (Randy J. Ray) from comp.lang.perl:
  13. >I thought that ".* would match anything (up to a final ")" in this case)
  14. >with $* set to 1?
  15.  
  16. Reading The Fabulous Manpage:
  17.  
  18. "Regular Expressions
  19.     [...]
  20.     To facilitate multi-line substitutions, the . character
  21.     never matches a newline (even when $* is 0).  In particular,
  22.     the following leaves a newline on the $_ string:
  23.  
  24.         $_ = <STDIN>;
  25.         s/.*(some_string).*/$1/;
  26. "
  27.  
  28. You have to use [.\n] if you want to match anything.
  29. -- 
  30. Raphael Manfredi <ram@eiffel.com>
  31. Interactive Software Engineering Inc.
  32. 270 Storke Road, Suite #7                      / Tel +1 (805) 685-1006 \
  33. Goleta, California 93117, USA                  \ Fax +1 (805) 685-6869 /
  34.