To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.admin.generalOpen lugnet.admin.general in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Administrative / General / 6068
6067  |  6069
Subject: 
Re: Lost Instructions
Newsgroups: 
lugnet.admin.general
Date: 
Thu, 13 Apr 2000 17:02:22 GMT
Viewed: 
716 times
  
In lugnet.admin.general, Dan Boger writes:
In lugnet.admin.general, Todd Lehman writes:
So something like

  m/^Re(?:\[\d+\]):\s*/i

might be even safer, since this would be for broken clients in the first
place, and cc:Mail is-was about as broken as one can get.  :-)

just for efficiancy's sake, you shouldn't put a /s* at the end - it's not
doing anything at all, is it?  if there's anything that matches the /s class,
it'll just take longer to complete the match, but if there's no /s at the
end, it'll still match just the same...

True -- the \s* isn't doing anything in that case.  The regex could be
considered a shorter form of

   ($subject_base) = ($subject_raw =~ m/^(Re(?:\[\d+\]):\s*)?(.*)$/i);

in which the \s* is actually needed.  I left it on in the example way above
for the same reason that /i is there instead of an explicit [Rr][Ee] --
because it's likely the difference beween one gazillionth of a second and one
bazillionth of a second.  (/i is slower than explicit character classes, but
it wouldn't make a practical speed difference here.)  The trailing \s* is
just a reminder that there has to be zero or more spaces (rather than one or
more) following the "Re:" in order to recognize it as a "Re:".

--Todd



Message is in Reply To:
  Re: Lost Instructions
 
(...) just for efficiancy's sake, you shouldn't put a /s* at the end - it's not doing anything at all, is it? if there's anything that matches the /s class, it'll just take longer to complete the match, but if there's no /s at the end, it'll still (...) (24 years ago, 13-Apr-00, to lugnet.admin.general)

10 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR