RE: regex puzzle
- From: zhao_bingfeng@xxxxxxxxxxxxx (Bingfeng Zhao)
- Date: Fri, 29 Jul 2005 15:11:14 +0800
Oh, bug,it should be
<CODE>
use warnings;
use strict;
my @address = ("http://test", "http://", "www", "", "ftp:/foo" );
for (@address)
{
print "\"$_\" is valid. \n" if /^((http|ftp):\/\/)?.+$/;
}
</CODE>
|-----Original Message-----
|From: bingfeng zhao [mailto:zhao_bingfeng@xxxxxxxxxxxxx]
|Sent: Friday, July 29, 2005 1:48 PM
|To: Perl Beginners List
|Subject: regex puzzle
|
|See following sample code:
|
|<CODE>
|use warnings;
|use strict;
|
|my @address = ("http://test", "http://", "www", "", "ftp:/foo" );
|
|for (@address)
|{
| print "\"$_\" passed! \n" if /^((http|ftp):\/\/)?.+$/; } </CODE>
|
|the running result is:
|"http://test" is valid.
|"http://" is valid.
|"www" is valid.
|"ftp:/foo" is valid.
|
|why "http://" and "ftp:/foo" can pass the check?
|
|
Attachment:smime.p7s
Description: S/MIME cryptographic signature
- Prev by Date: regex puzzle
- Next by Date: Podsaferadio
- Previous by thread: regex puzzle
- Next by thread: Re: regex puzzle
- Index(es):
Relevant Pages
|