Roman,
You don't need to do the substitute the second time. The first match will
populate the $1 & $2 variables as intended and you can then manipulate them
then as you wish in the subsequent expression:
if ($k_7 =~ /^(www\.(\S+|$))/i)
{
$k_7 = "<A href=\"http:\/\/$1\" title=\"$1\" target=\"_blank\">" .
subtr($2, 0, 40) . "<\/A>";
}
Joe
"Roman @ Melihhov" <[EMAIL PROTECTED]>@listserv.ActiveState.com on
10/18/2002 16:00:03
Sent by: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
cc:
Subject: [Perl-unix-users] regexp question: $1 result (HTML formatted
color-coded mail)
Sup,
I know how to match certain length patterns, but is there any way to return
only certain amount of the $1
if ($k_7 =~ /^(www\.(\S+|$))/i)
{$k_7 =~ s/(www\.(\S+|$))/<A href=\"http:\/\/$1\" title=\"$1\" target=\"
_blank\">$1<\/A>/gi;}
I need that $1 (in red) in the visible part of URL would be max 40
characters, while hyperlink actual path $1 be full length. Is there any way
to make it.
Ideas appreciated,
Roman.
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs