$xyz = "http://mysite/bbsui.jsp?id=dxpwd"; $id = $1 if ($xyz =~ m/\?id=(.+?)$/i);