/^From:.*?([\w.-]+@[\w.-]+)/

Discussion in 'Perl Misc' started by April, Nov 1, 2008.

  1. April

    April Guest

    found this re which claimed to match an email address:

    /^From:.*?([\w.-]+@[\w.-]+)/

    not sure I fully understand it, any help would be highly appreciated!

    -- I especially having issues with the ".*?" part and also could not
    find the meaning of "-" here.
    April, Nov 1, 2008
    #1
    1. Advertising

  2. April

    Tim Greer Guest

    April wrote:

    > found this re which claimed to match an email address:
    >
    > /^From:.*?([\w.-]+@[\w.-]+)/
    >
    > not sure I fully understand it, any help would be highly appreciated!
    >
    > -- I especially having issues with the ".*?" part and also could not
    > find the meaning of "-" here.


    ^ start of string.
    From: Start of string that starts with From:
    ..*? zero or more characters (. is any character) non greedy (?)
    anything in (...) is captured.
    [ ] is a character class of \w (any word character a-z and underscores
    _) or a dash (hyphen)
    [...]+ wher e+ is one or more of the characters in the []
    @ speaks for itself, though it should be \@, I'm sure (escaped).
    Another char class, with one or more characters.

    Unfortunately, that regular expression isn't very good. Not that a
    regex is able to always accurately tell if it looks acceptable (and
    certainly it can't know it's a real address), that above fails to do
    some reasonable checks. After all, someone could put it as From: -@-
    and it would be seen as valid... and so on. I'd recommend using a
    different script or regular expression if you plan to use that script.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
    Tim Greer, Nov 1, 2008
    #2
    1. Advertising

  3. April <> wrote:
    >found this re which claimed to match an email address:


    Well, it might, for some. And it will match many non-email addresses and
    will fail to match many actual addresses, too.

    >/^From:.*?([\w.-]+@[\w.-]+)/
    >
    >not sure I fully understand it, any help would be highly appreciated!


    It is a very(!) poor attempt. See 'perldoc -q valid'
    "How do I check a valid mail address?"
    for a discussion of the problems and more appropriate options.

    jue
    Jürgen Exner, Nov 1, 2008
    #3
  4. Tim Greer <> wrote:
    > April wrote:
    >
    >> found this re which claimed to match an email address:
    >>
    >> /^From:.*?([\w.-]+@[\w.-]+)/
    >>
    >> not sure I fully understand it, any help would be highly appreciated!
    >>
    >> -- I especially having issues with the ".*?" part and also could not
    >> find the meaning of "-" here.



    hyphen here means a hyphen character, ie. it is not a metacharacter.


    > [ ] is a character class of \w (any word character a-z and underscores
    > _)



    \w also includes the digit characters.


    > or a dash (hyphen)



    or a dot character.


    > @ speaks for itself, though it should be \@, I'm sure (escaped).



    Why are you sure?

    It does not need to be escaped, so you must misunderstand something...


    > Unfortunately, that regular expression isn't very good.



    That is for sure.


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Nov 1, 2008
    #4
  5. April

    Tim Greer Guest

    Tad J McClellan wrote:

    > Tim Greer <> wrote:
    >> April wrote:
    >>
    >>> found this re which claimed to match an email address:
    >>>
    >>> /^From:.*?([\w.-]+@[\w.-]+)/
    >>>
    >>> not sure I fully understand it, any help would be highly
    >>> appreciated!
    >>>
    >>> -- I especially having issues with the ".*?" part and also could not
    >>> find the meaning of "-" here.

    >
    >
    > hyphen here means a hyphen character, ie. it is not a metacharacter.
    >
    >
    >> [ ] is a character class of \w (any word character a-z and
    >> [ underscores
    >> _)

    >
    >
    > \w also includes the digit characters.


    >
    >> or a dash (hyphen)

    >
    >
    > or a dot character.
    >
    >> @ speaks for itself, though it should be \@, I'm sure (escaped).

    >
    >
    > Why are you sure?
    >
    > It does not need to be escaped, so you must misunderstand something...
    >



    I don't know what I was thinking earlier. Thanks for pointing out those
    flaws in my response.

    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
    Tim Greer, Nov 1, 2008
    #5
  6. April

    April Guest

    On Nov 1, 2:22 am, Tim Greer <> wrote:
    > Tad J McClellan wrote:
    > > Tim Greer <> wrote:
    > >> April wrote:

    >
    > >>> found this re which claimed to match an email address:

    >
    > >>> /^From:.*?([\w.-]+@[\w.-]+)/

    >
    > >>> not sure I fully understand it, any help would be highly
    > >>> appreciated!

    >
    > >>> -- I especially having issues with the ".*?" part and also could not
    > >>> find the meaning of "-" here.

    >
    > > hyphen here means a hyphen character, ie. it is not a metacharacter.

    >
    > >> [ ] is a character class of \w (any word character a-z and
    > >> [ underscores
    > >> _)

    >
    > > \w also includes the digit characters.

    >
    > >> or a dash (hyphen)

    >
    > > or a dot character.

    >
    > >> @ speaks for itself, though it should be \@, I'm sure (escaped).

    >
    > > Why are you sure?

    >
    > > It does not need to be escaped, so you must misunderstand something...

    >
    > I don't know what I was thinking earlier.  Thanks for pointing out those
    > flaws in my response.
    >
    > --
    > Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    > Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    > and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
    > Industry's most experienced staff! -- Web Hosting With Muscle!- Hide quoted text -
    >
    > - Show quoted text -


    Thanks Tim, Tad and Jue .. now it's much clear to me! One thing left
    is whether .*? simply means anything appears before (...)? April
    April, Nov 1, 2008
    #6
  7. April <> wrote:
    >> >> April wrote:

    >>
    >> >>> /^From:.*?([\w.-]+@[\w.-]+)/

    >>
    >> --
    >> Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    >> Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    >> and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
    >> Industry's most experienced staff! -- Web Hosting With Muscle!- Hide quoted text -


    [Please do not quote signatures]

    >> - Show quoted text -


    Is this line meant to mean anything?

    >Thanks Tim, Tad and Jue .. now it's much clear to me! One thing left
    >is whether .*? simply means anything appears before (...)? April


    <quoted from Tim>
    ..*? zero or more characters (. is any character) non greedy (?)
    </quote>
    :
    Why don't you go and check 'perldoc perlre'? There you will find
    . Match any character (except newline)
    * Match 0 or more times
    And the meaning of ? is explained two paragraphs down from there.

    jue
    Jürgen Exner, Nov 1, 2008
    #7
  8. April

    April Guest

    On Nov 1, 12:34 pm, Jürgen Exner <> wrote:
    > April <> wrote:
    > >> >> April wrote:

    >
    > >> >>> /^From:.*?([\w.-]+@[\w.-]+)/

    >
    > >> --
    > >> Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    > >> Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    > >> and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
    > >> Industry's most experienced staff! -- Web Hosting With Muscle!- Hide quoted text -

    >
    > [Please do not quote signatures]
    >
    > >> - Show quoted text -

    >
    > Is this line meant to mean anything?
    >
    > >Thanks Tim, Tad and Jue .. now it's much clear to me!  One thing left
    > >is whether .*? simply means anything appears before (...)?  April

    >
    > <quoted from Tim>
    > .*? zero or more characters (. is any character) non greedy (?)
    > </quote>
    > :
    > Why don't you go and check 'perldoc perlre'? There you will find
    >         .   Match any character (except newline)
    >         *      Match 0 or more times
    > And the meaning of ? is explained two paragraphs down from there.
    >
    > jue


    not sure what viewer you are using, I'm using Google group and what
    you gets is the default.

    Also, no one learns a language by reading docs alone I guess .. I
    appreciate your input when you care, otherwise you may choose to skip
    please.
    April, Nov 1, 2008
    #8
  9. April

    April Guest

    On Nov 1, 9:54 am, April <> wrote:
    > On Nov 1, 2:22 am, Tim Greer <> wrote:
    >
    >
    >
    >
    >
    > > Tad J McClellan wrote:
    > > > Tim Greer <> wrote:
    > > >> April wrote:

    >
    > > >>> found this re which claimed to match an email address:

    >
    > > >>> /^From:.*?([\w.-]+@[\w.-]+)/

    >
    > > >>> not sure I fully understand it, any help would be highly
    > > >>> appreciated!

    >
    > > >>> -- I especially having issues with the ".*?" part and also could not
    > > >>> find the meaning of "-" here.

    >
    > > > hyphen here means a hyphen character, ie. it is not a metacharacter.

    >
    > > >> [ ] is a character class of \w (any word character a-z and
    > > >> [ underscores
    > > >> _)

    >
    > > > \w also includes the digit characters.

    >
    > > >> or a dash (hyphen)

    >
    > > > or a dot character.

    >
    > > >> @ speaks for itself, though it should be \@, I'm sure (escaped).

    >
    > > > Why are you sure?

    >
    > > > It does not need to be escaped, so you must misunderstand something....

    >
    > > I don't know what I was thinking earlier.  Thanks for pointing out those
    > > flaws in my response.

    >
    > > --
    > > Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    > > Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    > > and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
    > > Industry's most experienced staff! -- Web Hosting With Muscle!- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > Thanks Tim, Tad and Jue .. now it's much clear to me!  One thing left
    > is whether .*? simply means anything appears before (...)?  April- Hidequoted text -
    >
    > - Show quoted text -


    The reason I wasn't sure is that the following cannot be picked up by
    an if test:

    From Tue Apr 24 11:02:41 2002

    if test: elsif ($header && /^From:.*?([\w.-]+@[\w.-]+)/)

    I modified From: to From in the above and also checked still in the
    header secton.

    In fact this is from the bayview website, Exercise "Analyze Mail
    Folder", solution and auxilary files, but seems the solution is not
    working for this part.
    April, Nov 1, 2008
    #9
  10. April

    Tim Greer Guest

    April wrote:

    > if test:  elsif ($header && ^From:.*?([\w.-]+@[\w.-]+))


    The above isn't showing any delimiters for me. Anyway, the From in your
    example doesn't have a colon :)) following it in the actual email
    "from" line you posted. Where/what is $_ coming from for your check?
    If $_ isn't what you want to check against, you might want $variable
    =~ /m/. Anyway, try chaning it to /^From:?.*?([\w.-]+@[\w.-]+)/ :?
    makes ":" optional in the regex match.

    Also, do you want to capture the address? If not, you don't need to use
    () in the regex. Again, I'd suggest a better check, especially if you
    want to ensure it makes some attempt to verify it's at least a
    legitimate _looking_ email address, but if you're not doing that, then
    I suppose thw above should work for capturing most.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
    Tim Greer, Nov 1, 2008
    #10
  11. April <> wrote:
    >On Nov 1, 12:34 pm, Jürgen Exner <> wrote:
    >> [Please do not quote signatures]
    >> >> - Show quoted text -

    >> Is this line meant to mean anything?


    >not sure what viewer you are using,


    I am not using any viewer. As you can easily see in the headers
    currently I am using Forte Agent as my newsreader.

    >I'm using Google group and what


    If you prefer a crude web page interface lacking any features and having
    poor performance then of course that's your choice.

    >you gets is the default.


    It has been customary for the past 25+ years to trim quotes to those
    parts that are relevant to your reply. If Google Groups doesn't allow
    you to do that then this is one more reason to avoid it.

    Also I can only guess that your comment was related to those parts that
    I quoted above and not to those that I snipped, because you didn't
    bother to remove those that were irrelevant to your reply.

    >Also, no one learns a language by reading docs alone I guess .. I
    >appreciate your input when you care, otherwise you may choose to skip
    >please.


    http://www.catb.org/~esr/faqs/smart-questions.html, in particular
    http://www.catb.org/~esr/faqs/smart-questions.html#examples

    You didn't show any indication about if or what you tried already to
    answer the question yourself and neither what your underlying goals
    where. This leaves the door wide open to all kinds of guesses including
    but not limited to someone is too lazy to read TFM for himself, someone
    is fishing for free lunch, someone did read TFM but didn't understand it
    (too bad he didn't say which parts he has trouble with), someone didn't
    know where to find TFM, ...

    The case of "I am learning the language and just got stuck at this
    specific spot and need a little help with it" unfortunately is the least
    common case and therefore typically not the default assumption when all
    indications for background and motivation are missing.

    A suggestion:
    If you want to learn about REs, then you could have sad so easily.
    'I am learning REs and found this example: /^From:.*?([\w.-]+@[\w.-]+)/
    Although I checked 'perldoc perlre' I still don't understand the '.*?'.
    Could someone explain, please?'

    This is very different from your question. Now people know what you are
    after (so there is no need to go off on irrelevant tangents like the FAQ
    answer on validating email addresses), what you tried already (so there
    is no need to repeat that), and they know exactly where you got stuck
    (so the answer can be specific and targeted).

    jue
    Jürgen Exner, Nov 1, 2008
    #11
  12. April <> wrote:
    >The reason I wasn't sure is that the following cannot be picked up by
    >an if test:
    >
    > From Tue Apr 24 11:02:41 2002
    >
    >if test: elsif ($header && /^From:.*?([\w.-]+@[\w.-]+)/)
    >
    >I modified From: to From in the above


    Well, the RE is explicitely asking for that colon. If it doesn't exist
    in the text, then the RE won't match.

    >and also checked still in the header secton.


    No idea what you mean by that sentence.

    jue
    Jürgen Exner, Nov 1, 2008
    #12
  13. April <> wrote:


    > Also, no one learns a language by reading docs alone I guess ..



    Also, no one learns a language by posting every question that
    occurs to them to Usenet without even trying to find the answer
    themselves first.

    You are abusing our newsgroup. This does not endear you to us...


    > you may choose to skip
    > please.



    Your choice appears to continue to do what is seen as rude here.

    My choice is to auto-delete unread every post you make in the future. [1]

    So long!




    [1] Which is no big deal as there are lots of other people who can
    read the docs to you. If however, dozens of others do the same,
    then you eventually get less and less help here. Your choice.

    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Nov 1, 2008
    #13
  14. April

    April Guest

    On Nov 1, 3:42 pm, Jürgen Exner <> wrote:
    > April <> wrote:
    > >The reason I wasn't sure is that the following cannot be picked up by
    > >an if test:

    >
    > >    From Tue Apr 24 11:02:41 2002

    >
    > >if test:  elsif ($header && /^From:.*?([\w.-]+@[\w.-]+)/)

    >
    > >I modified From: to From in the above

    >
    > Well, the RE is explicitely asking for that colon. If it doesn't exist
    > in the text, then the RE won't match.


    I did say when the : moved it still won't match ...

    >
    > >and also checked still in the header secton.

    >
    > No idea what you mean by that sentence.


    as && requires the matching needs to be done in the header ($header)
    section ..

    >
    > jue
    April, Nov 1, 2008
    #14
  15. April

    April Guest

    On Nov 1, 3:36 pm, Jürgen Exner <> wrote:

    > If you prefer a crude web page interface lacking any features and having
    > poor performance then of course that's your choice.
    >
    > >you gets is the default.

    >
    > It has been customary for the past 25+ years to trim quotes to those
    > parts that are relevant to your reply. If Google Groups doesn't allow
    > you to do that then this is one more reason to avoid it.
    >
    > Also I can only guess that your comment was related to those parts that
    > I quoted above and not to those that I snipped, because you didn't
    > bother to remove those that were irrelevant to your reply.


    I applogize but am suprised people feel so strongly about the posting
    style ... I always think posting with the history will provide
    neccessary backgroud for anyone with convenience to respond, for
    people familiar with the thread, skip the unneccessry part and get to
    the point; for those unfamiliar, then have the background right
    there ...

    However, if that's what expected, I can adapt it ...

    >
    > >Also, no one learns a language by reading docs alone I guess .. I
    > >appreciate your input when you care, otherwise you may choose to skip
    > >please.

    >
    > http://www.catb.org/~esr/faqs/smart-questions.html, in particularhttp://www.catb.org/~esr/faqs/smart-questions.html#examples
    >
    > You didn't show any indication about if or what you tried already to
    > answer the question yourself and neither what your underlying goals
    > where. This leaves the door wide open to all kinds of guesses including
    > but not limited to someone is too lazy to read TFM for himself, someone
    > is fishing for free lunch, someone did read TFM but didn't understand it
    > (too bad he didn't say which parts he has trouble with), someone didn't
    > know where to find TFM, ...


    the issue with TEM or other general doc is that they say so many
    things the ways should be, however, they won't tell you whether and
    how it applies to a particular case .. as a new leaner, what I need is
    a confirmation that it applies here and in this way.

    the other part I also have issues is to identfy things that are
    specific applications of certain functions or statements, or whatever
    you name it.

    >
    > The case of  "I am learning the language and just got stuck at this
    > specific spot and need a little help with it" unfortunately is the least
    > common case and therefore typically not the default assumption when all
    > indications for background and motivation are missing.
    >
    > A suggestion:
    > If you want to learn about REs, then you could have sad so easily.
    > 'I am learning REs and found this example: /^From:.*?([\w.-]+@[\w.-]+)/
    > Although I checked 'perldoc perlre' I still don't understand the '.*?'.
    > Could someone explain, please?'


    I don't know what you mean here, it seems to me based on my initial
    question, anyone would figure out I'm new to Perl.

    >
    > This is very different from your question. Now people know what you are
    > after (so there is no need to go off on irrelevant tangents like the FAQ
    > answer on validating email addresses), what you tried already (so there
    > is no need to repeat that), and they know exactly where you got stuck
    > (so the answer can be specific and targeted).
    >
    > jue
    April, Nov 1, 2008
    #15
  16. April

    April Guest

    On Nov 1, 3:02 pm, Tim Greer <> wrote:
    > April wrote:
    > > if test:  elsif ($header && ^From:.*?([\w.-]+@[\w.-]+))

    >
    > The above isn't showing any delimiters for me.  Anyway, the From in your
    > example doesn't have a colon :)) following it in the actual email
    > "from" line you posted.  Where/what is $_ coming from for your check?
    > If $_ isn't what you want to check against, you might want $variable
    > =~ /m/.  Anyway, try chaning it to  /^From:?.*?([\w.-]+@[\w.-]+)/  :?
    > makes ":" optional in the regex match.
    >
    > Also, do you want to capture the address?  If not, you don't need to use
    > () in the regex.  Again, I'd suggest a better check, especially if you
    > want to ensure it makes some attempt to verify it's at least a
    > legitimate _looking_ email address, but if you're not doing that, then
    > I suppose thw above should work for capturing most.
    > --
    > Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    > Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    > and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
    > Industry's most experienced staff! -- Web Hosting With Muscle!


    Thanks Tim .. moved the test to the beginning of the script and either
    removing the : or escaping it will be able to capture the email
    addresses .. so it's a logic problem somewhere in the solution
    provided, and I'll be working on that find it out. Really appreciate
    your help and patience. April
    April, Nov 2, 2008
    #16
  17. April

    April Guest

    On Nov 1, 8:58 pm, April <> wrote:
    > On Nov 1, 3:02 pm, Tim Greer <> wrote:
    >
    >
    >
    >
    >
    > > April wrote:
    > > > if test:  elsif ($header && ^From:.*?([\w.-]+@[\w.-]+))

    >
    > > The above isn't showing any delimiters for me.  Anyway, the From in your
    > > example doesn't have a colon :)) following it in the actual email
    > > "from" line you posted.  Where/what is $_ coming from for your check?
    > > If $_ isn't what you want to check against, you might want $variable
    > > =~ /m/.  Anyway, try chaning it to  /^From:?.*?([\w.-]+@[\w.-]+)/ :?
    > > makes ":" optional in the regex match.

    >
    > > Also, do you want to capture the address?  If not, you don't need to use
    > > () in the regex.  Again, I'd suggest a better check, especially if you
    > > want to ensure it makes some attempt to verify it's at least a
    > > legitimate _looking_ email address, but if you're not doing that, then
    > > I suppose thw above should work for capturing most.
    > > --
    > > Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    > > Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    > > and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
    > > Industry's most experienced staff! -- Web Hosting With Muscle!

    >
    > Thanks Tim .. moved the test to the beginning of the script and either
    > removing the : or escaping it will be able to capture the email
    > addresses .. so it's a logic problem somewhere in the solution
    > provided, and I'll be working on that find it out.  Really appreciate
    > your help and patience.  April- Hide quoted text -
    >
    > - Show quoted text -


    just an update .. after moving the specifc if loop up to be part of
    the envelope check, now the errors in the provided "solution" fixed
    and the script works as expected. Again, thanks everyone! - April
    April, Nov 2, 2008
    #17
  18. April

    Scott Bryce Guest

    April wrote:
    >>> if test: elsif ($header && /^From:.*?([\w.-]+@[\w.-]+)/)


    <snip>

    > as && requires the matching needs to be done in the header ($header)


    No. The $header && requires only that whatever value is stored in
    $header evaluates to TRUE, which it would not do if it had no value at
    all. It is probably a test to see whether $header contains a non-null value.

    If you wanted to require that the matching be done to the value stored
    in $header, you would write that as

    elsif ($header =~ /^From:.*?([\w.-]+@[\w.-]+)/)
    Scott Bryce, Nov 2, 2008
    #18
  19. April

    Scott Bryce Guest

    April wrote:
    > I applogize but am suprised people feel so strongly about the posting
    > style


    The regulars here expect a certain posting style because it communicates
    effectively in this medium.

    > ... I always think posting with the history will provide neccessary
    > backgroud for anyone with convenience to respond, for people familiar
    > with the thread, skip the unneccessry part and get to the point; for
    > those unfamiliar, then have the background right there ...


    What the regulars expect is that you will quote enough to provide
    necessary background, and that YOU will skip the unnecessary parts by
    trimming them from your post.

    > the issue with TFM or other general doc is that they say so many
    > things the ways should be, however, they won't tell you whether and
    > how it applies to a particular case .. as a new leaner, what I need
    > is a confirmation that it applies here and in this way.


    Questions of that type should be fair game here.

    > the other part I also have issues is to identfy things that are
    > specific applications of certain functions or statements, or whatever
    > you name it.


    Questions of that type should also be fair game here.

    > I don't know what you mean here, it seems to me based on my initial
    > question, anyone would figure out I'm new to Perl.


    We know that you are new to Perl. What people want to see is some
    indication that you are putting out some effort yourself, and that you
    don't expect us to spoon feed it to you. If the answer to your question
    is in the docs, hopefully you have made some effort to find the answer
    there.

    Have you read the posting guidelines that are posted here twice weekly?
    They will help you ask your questions in a way that will make it easier
    for people here to answer you.
    Scott Bryce, Nov 2, 2008
    #19
  20. April

    April Guest

    On Nov 2, 9:44 am, Scott Bryce <> wrote:
    > April wrote:
    > >>> if test:  elsif ($header && /^From:.*?([\w.-]+@[\w.-]+)/)

    >
    > > as && requires the matching needs to be done in the header ($header)

    >
    > No. The $header && requires only that whatever value is stored in
    > $header evaluates to TRUE, which it would not do if it had no value at
    > all. It is probably a test to see whether $header contains a non-null value.
    >


    what I meant was as $header also needs to be evaluated true (&&), so
    this test must be done in the header section which is what $header
    stands for.
    April, Nov 2, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page