bingfeng zhao wrote:
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?
Because ((http|ftp):\/\/) is optional ( the ? following it does that ),
so any line with anything between the start and end of the line will pass.
--
Flemming Greve Skovengaard FAITH, n.
a.k.a Greven, TuxPower Belief without evidence in what is told
<[EMAIL PROTECTED]> by one who speaks without knowledge,
4112.38 BogoMIPS of things without parallel.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>