In article 
<[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] (Jean-Francois Messier) wrote:

>       I'm a beginner in those regular expressions and s/// operations. How
> can I extract only the digits and the periods (.) from a string ? I have
> something like 206.48.16.3/12345. An IP address with a port number. There
> are digits on both sides of the slash, but I would like to keep only the
> digits from on the left as well as the periods. More complex question: If I
> have something like "src=206.48.16.3/12345", how can I do the same as bove,
> but also removing the "src=" at the beginning ?

my $ip = "src=206.48.16.3/12345";
$ip =~ s{^src=|/\d+$}{}g;
print $ip;
-- 
brian d foy <[EMAIL PROTECTED]> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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

Reply via email to