Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

having problem in writing regular expression in tcl

Status
Not open for further replies.

mohtasham1983

Programmer
Oct 28, 2006
1
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top