#!C:\Perl -w

$uri = 'http://www.ics.uci.edu/pub/ietf/uri/#Related';
$line1 = 'the FOX is';

if ($line1 =~ / (f.{1}x) /i) {
	print "Matched $1...\n";
}


##if ($uri =~ /^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/ ) {
if ($uri =~ /^(([^:\/?]+):)?(\/\/([^\/?]*))?([^?]*)(\?([^#]*))?((.*))?/ ) {
	#         12            3    4          5      6  7        89
	$scheme    = $2;
	$authority = $4;
    $path      = $5;
    $query     = $7;
    $fragment  = $9;
	#print "sch[$scheme]auth[$authority]path[$path]query[$query]frag[$fragment]\n";
	if (defined $scheme) {
		print "sch[$scheme] ";
	} else {
		print "sch[undefined] ";
	}
	if (defined $authority) {
		print "auth[$authority] ";
	} else {
		print "auth[undefined] ";
	}
	if (defined $path) {
		print "path[$path] ";
	} else {
		print "path[undefined] ";
	}
	if (defined $query) {
		print "query[$query] ";
	} else {
		print "query[undefined] ";
	}
	if (defined $fragment) {
		print "frag[$fragment] ";
	} else {
		print "frag[undefined] ";
	}
	print "\n";

}

print "Done ...\n";

show_cond( 0, 1 );
show_cond( 1, 1 );
show_cond( 1, 0 );
show_cond( 0, 0 );


sub show_cond {
	($cond1, $cond2) = @_;
	print "With $cond1 $cond2 ...\n";
	if ( !( $cond1 && !$cond2 ) ) {
		print "1 Bits removed ... ";
	} else {
		print "1 Bits NOT removed ... ";
	}
	if ( !$cond1 || $cond2 ) {
		print "2 Bits removed ...\n";
	} else {
		print "2 Bits NOT removed ...\n";
	}
}

# eof - test11.pl
