How do I append a string to specific search query

The code is JScript .NET, which is basically a .NET version of Javascript. Regardless of language, Anyone with appending type of skill can answer my question

The problem with the below code is that it appends string to the very end of the URL

if (oSession.uriContains("q=")) 
    {
        var str = oSession.fullUrl;
        var sAppend = "+test1+test2+test3";
        if (!oSession.uriContains(sAppend))
        {
            oSession.fullUrl = str + sAppend;
        }
    }

So, How can I place +test1+test2+test3 right next to q= ?

Example:www.google.co.uk/search?q=+test1+test2+test3&aqs=chrome..69i57.1582j0j4&sourceid=chrome&es_sm=122&ie=UTF-8

Thank you