Posted to tcl by gwlester at Fri Jun 16 20:38:43 GMT 2017view raw
- set srvurl {}; # the "this_part_here" of: http://foo.bar/this_part_here
- set validityRE {(?xi)
- ^
- # Path part (already must start with / character)
- (?: [-\w.~!$&'()*+,;=:@/] | %[0-9a-f][0-9a-f] )*
- # Query part (optional, permits ? characters)
- (?: \? (?: [-\w.~!$&'()*+,;=:@/?] | %[0-9a-f][0-9a-f] )* )?
- $
- }
- if {![regexp -- $validityRE $srvurl]} {
- unset $token
- # Provide a better error message in this error case
- if {[regexp {(?i)%(?![0-9a-f][0-9a-f])..} $srvurl bad]} {
- puts stdout "Yes!! That is it!!"
- }
- puts stdout error "No, try again. :("
- }