mohtasham1983
Programmer
I have a procedure in my program which must verify a URL.
Code:
proc Test_URI {uri} {
regexp {/|[a-zA-Z\.\-]+?)(?:[0-9]+))?(/.*)$} $uri match
if {$uri == ""} { #if URI is empty make a list containing status and reason of wrong URI set answer {"incorrect" "empty"}
} elseif {[info exists match]} { set answer {"correct"} } else { set answer {"incorrect" "Wrong URI"} }
}
set ur " 3eedub.com:80/book/" set result_uri [Test_URI $ur] puts "URI is $result_uri"
there is a space in url address, which means the url is not valid. But the program returns valid url. i mentioned that only [a-z,A-Z\.\-] can be in the name of uri.
Any idea how to include space as a parameter in my regular expression?
Thanks
Code:
proc Test_URI {uri} {
regexp {/|[a-zA-Z\.\-]+?)(?:[0-9]+))?(/.*)$} $uri match
if {$uri == ""} { #if URI is empty make a list containing status and reason of wrong URI set answer {"incorrect" "empty"}
} elseif {[info exists match]} { set answer {"correct"} } else { set answer {"incorrect" "Wrong URI"} }
}
set ur " 3eedub.com:80/book/" set result_uri [Test_URI $ur] puts "URI is $result_uri"
there is a space in url address, which means the url is not valid. But the program returns valid url. i mentioned that only [a-z,A-Z\.\-] can be in the name of uri.
Any idea how to include space as a parameter in my regular expression?
Thanks