On 9/1/07, Chris E. Rempola <[EMAIL PROTECTED]> wrote: snip > Can you explain the regex syntax of /#.*\s(\S+)/ > > How does that match the email address? The reason why I ask is because > I have one occurrence with the ouput of: > > ++++ OUTPUT +++++++++ > 'bouncing' sent 402 emails. > ++++ /OUTPUT ++++++++ > > This was due to the fact that the format consisted of: > > ++++ FORMAT +++++++++ > 31 Aug 2007 04:00:22 GMT #8810118 337545 <[EMAIL PROTECTED]> bouncing > ++++ /FORMAT +++++++++ > > So the script grabbed "bouncing" instead of the email address. I want > to understand it so I can have it grab the email address in those > instances. Thanks again! > > -Chris
The pattern /#.*\s(\S+)/ matches a literal # followed by anything up to a space and captures all contiguous non-space characters: "31 Aug 2007 04:00:22 GMT " prematch "#" matches # "8810118 337545 <[EMAIL PROTECTED]>" matches .* " " matches \s "bouncing" matches \S+ Even turning on non-greedy matching won't help, it will just cause it to match 337545. So we need to take a different approach. Try /#\d+\s+\d+\s+(\S*)/ instead. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/