Works in Notepad++ 6.3.2. This accommodates any issues with inconsistent space and tab characters potentially being used.
Search Pattern
mysql_query\(\s*\$([^,\s]+)\s*,\s*\$db\s*\);
Replacement
\$mysqli->query\(\$\1\);
(Make sure Regular Expression radio button is selected in the replace dialogue box).
test Text
mysql_query($query, $db);
mysql_query($SQL , $db);
mysql_query($query2, $db);
mysql_query( $SQL_v4, $db );
mysql_query($AnotherSQL,$db);
Output Text
$mysqli->query($query);
$mysqli->query($SQL);
$mysqli->query($query2);
$mysqli->query($SQL_v4);
$mysqli->query($AnotherSQL);