himanshu.padmanabhi has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Regular Expression problem
by jethro (Monsignor) on Apr 24, 2009 at 11:38 UTC

    Well, to just get the message and email address in a naive way you could do (untested)

    my ($message,$email)=m{^-S\s* "([^"]*)" \s* (.*)}x;

    BUT this way you don't allow any escaped " in your message string. i.e. something like "hi, that \" char is difficult". If you change [^"]* to .* then it would allow escaped ", but then you would get into trouble if the email address had any " char in it, for example "John Doe" <doe@wo.com>.

    Also note there is no real checking if the email address comforms to any email address standard. If you only expect doe@wo.com style addresses, that could be parsed with something like [^@]+@[^@]+, but to parse any valid email address you should use a module like Mail::Address.

    If you get this line from unknown sources, there are more things to consider, depending on what you want to do

Re: Regular Expression problem
by ELISHEVA (Prior) on Apr 24, 2009 at 10:16 UTC

    And the hoped for output is?

    Please see, How (Not) To Ask A Question for some hints on how to write a question that will be effective in getting you the help you need.

    Best, beth

Re: Regular Expression problem
by lakshmananindia (Chaplain) on Apr 24, 2009 at 10:18 UTC
Re: Regular Expression problem
by Anonymous Monk on Apr 24, 2009 at 10:16 UTC
    /-S "any message including strings,number" email-addr/??