Question on regexp in TCL

I need some help with regexp in tcl. The following code does work if the $urlvar ends in jpg,jpeg,png or gif. Eg, protocol(http/https)://testsite.com/images/image1.jpg

if { ![regexp -nocase {(jpg|jpeg|png|gif)$} $urlvar]  }  {
        //Do something
}

My problem is that if the URL does not end in these extensions this regexp is of no use. For eg, how to make this work for a URL with query strings or anything else afer the extension
Eg:

protocol(http/https)://testsite.com/images/image1.jpg?height=100&width=80

Help will be appreciated.

How about:

if { [regexp -nocase {\.(jpg|jpeg|png|gif)$|\?} $urlvar] }