Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > RegEx...

Reply
Thread Tools

RegEx...

 
 
wizgod@yahoo.com
Guest
Posts: n/a
 
      01-26-2005
To All hello. I am trying to grab a specific portion of the e-mail
address from
a string on the fly and for some reason It's(That is perl is not liking
what ever I Do.) I would appreciate your guidance oh great perl gurus
of the internet....

my $messageid = ( $string =~ m{Message-ID:
\<(E-Mail Removed)>});
^^^^^^^^^^^^---This is
what I want.
But for some reason everything I try just will not work. This has to
happen this way as I'm doing someother processing on the fly with
string and what feeds
string isn't actually available for very long if you know what I mean.
Any Help would be great.

Jim,

 
Reply With Quote
 
 
 
 
Brian McCauley
Guest
Posts: n/a
 
      01-26-2005


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> To All hello. I am trying to grab a specific portion of the e-mail
> address from a string on the fly and...


The exact syntax of email addresses is far from simple. There are
modules on CPAN to parse them.


> my $messageid = ( $string =~ m{Message-ID:
> \<(E-Mail Removed)>});
> ^^^^^^^^^^^^---This is
> what I want.


You apper to be mixing up your program and your data. Please produce a
minimal but complete script that you have actually run and which
illustrates the problem you are having.

Note also that the m// operator only returns the list of captures in a
list context but you don't capture anything.

> But for some reason everything I try just will not work.


"not work" is a red flag phrase.

When ever you find yourself typing it you should immediately delete it
and replace it with a description of what happend.

> This has to
> happen this way as I'm doing someother processing on the fly with
> string and what feeds
> string isn't actually available for very long if you know what I mean.


No, I have absolutely no idea what you mean. What has to happen in what
way?

> Any Help would be great.


Please see the posting guidelines. Hope that helps.

 
Reply With Quote
 
 
 
 
terry l. ridder
Guest
Posts: n/a
 
      01-26-2005
On Wed, 26 Jan 2005, (E-Mail Removed) wrote:

> To All hello. I am trying to grab a specific portion of the e-mail
> address from


first off, the message-id is not an e-mail address. message-id is a
globally unique identifier for that particular message.

> a string on the fly and for some reason It's(That is perl is not liking
> what ever I Do.) I would appreciate your guidance oh great perl gurus
> of the internet....
>
> my $messageid = ( $string =~ m{Message-ID:
> \<(E-Mail Removed)>});
> ^^^^^^^^^^^^---This is
> what I want.
>


it is not clear to me what you want.
it would appear that you are search for one specific message-id.

> But for some reason everything I try just will not work. This has to
> happen this way as I'm doing someother processing on the fly with
> string and what feeds
> string isn't actually available for very long if you know what I mean.
> Any Help would be great.
>
> Jim,
>
>


--
terry l. ridder ><>
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      01-26-2005
"(E-Mail Removed)" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) oups.com:

> To All hello. I am trying to grab a specific portion of the e-mail
> address from a string on the fly and for some reason It's (That is
> perl is not liking what ever I Do.) I would appreciate your guidance
> oh great perl gurus of the internet....


The guidance you seek is provided in the posting guidelines for this
group. Please read them.

> my $messageid = ( $string =~ m{Message-ID:
> \<(E-Mail Removed)>});
> ^^^^^^^^^^^^---This is
> what I want.
> But for some reason everything I try just will not work.



It looks like you have neither

use strict;

nor

use warnings;

in your script.

#! /usr/bin/perl

use strict;
use warnings;

my $s = q{Message-ID:\<(E-Mail Removed)};

my $msg_id = ( $s =~ m{Message-ID:\<(E-Mail Removed)>});
__END__

C:\Dload> q
Possible unintended interpolation of @news in string at C:\Dload\q.pl
line 8. Global symbol "@news" requires explicit package name at
C:\Dload\q.pl line 8. Execution of C:\Dload\q.pl aborted due to
compilation errors.

Also, I am not sure why you are escaping <.

Sinan.
 
Reply With Quote
 
Tore Aursand
Guest
Posts: n/a
 
      01-26-2005
(E-Mail Removed) wrote:
> To All hello. I am trying to grab a specific portion of the e-mail
> address from
> a string on the fly and for some reason It's(That is perl is not liking
> what ever I Do.) I would appreciate your guidance oh great perl gurus
> of the internet....
>
> my $messageid = ( $string =~ m{Message-ID:
> \<(E-Mail Removed)>});
> ^^^^^^^^^^^^---This is
> what I want.


Use the 'Mail::Address' module from CPAN. From the top of my head, it
works something like this;

#!/usr/bin/perl
#
use strict;
use warnings;
use Mail::Address;

my $string = 'Message-ID: <(E-Mail Removed)>';
my @addresses = Mail::Address->parse( $string );

foreach ( @addresses ) {
print $_->user() . "\n";
}


--
Tore Aursand <(E-Mail Removed)>
"I didn't have time to write a short letter, so I wrote a long one
instead." (Mark Twain)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments