Regexes are always more fun :)  How else can you write a program with almost
no letters.

$email =~ s/(?<[EMAIL PROTECTED]).*$/.../;

perldoc perlre

search for 'look-behind'

Scott

-----Original Message-----
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 10:36 PM
To: Sara
Cc: [EMAIL PROTECTED]
Subject: Re: Regex and Email address.


Sara wrote:
> Simple Regex problem....
> 
> How you will convert 
> 
> $email = "[EMAIL PROTECTED]";
> 
> TO
> 
> $email = "[EMAIL PROTECTED]";
> 
> using Regex.
> 

Well this isn't necessarily a regex issue, TMTOWTDI,

my $email = '[EMAIL PROTECTED]';
$email = substr($email, 0, (index($email,'@')+2));
print "Email: $email...\n";

perldoc -f index
perldoc -f substr

...of course having said that you *can* do it with a regex ;-) ....

my $email = '[EMAIL PROTECTED]';
$email =~ s/^([EMAIL PROTECTED]).*/$1/;
print "Email: $email...\n";

HTH,

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to