Regexpr FTP

M

MC

Hi,

i'm trying to make a regexpr wether an ftp-input is valid or not.
this is what i have:

$var = "ftp://user:pass@localhost:21";
if ( $var =~ /^ftp:\/\/([^:]*):([^@]*)@([^:]*):(.*)$/i ) { print
"$1:$2@".$3.":$4\n"; }Can anyone tell me if something is wrong with
this?For some reason it won't accept the "@" in the middle,if i replace it
with "!" for example the expr works just fine.i've also tried escaping it,
also no luck.Thanks
 
J

Jim Gibson

MC <madcow@false> said:
Hi,

i'm trying to make a regexpr wether an ftp-input is valid or not.
this is what i have:

$var = "ftp://user:pass@localhost:21";
if ( $var =~ /^ftp:\/\/([^:]*):([^@]*)@([^:]*):(.*)$/i ) { print
"$1:$2@".$3.":$4\n"; }Can anyone tell me if something is wrong with
this?For some reason it won't accept the "@" in the middle,if i replace it
with "!" for example the expr works just fine.i've also tried escaping it,
also no luck.Thanks

You need to escape the '@' in $var. If I do that, it works fine for me.
If you had put 'use strict;' and 'use warnings;' at the beginning of
your program perl would have told you that. Next time, please show a
complete program that demonstrates your problem, and please post to
comp.lang.perl.misc instead because this newsgroup is defunct.
 
M

Martin Gregory

Jim said:
Next time, please show a
complete program that demonstrates your problem, and please post to
comp.lang.perl.misc instead because this newsgroup is defunct.

Out of interest, what does being "defunct" mean? How does one know that it is the case?

Obviosuly people are writing to and reading this group... what
status does 'defunct' confer?

Ta,
 
J

Jim Gibson

Martin Gregory said:
Out of interest, what does being "defunct" mean? How does one know that it
is the case?

I know it is defunct because people tell me it is defunct. :)
Obviosuly people are writing to and reading this group... what
status does 'defunct' confer?

It means the Usenet protocol command 'rmgroup' was issued for this
newsgroup. This happened many years ago. However, improperly-configured
newservers (like the ones you and I are accessing) can continue to
publish and receive articles posted to comp.lang.perl.

See http://tinyurl.com/4skts for the best description I have seen of
the status of comp.lang.perl.

To repeat: comp.lang.perl is defunct!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top