Page 1 of 1

How do I append a string to search query only once ?

Posted: Thu Sep 18, 2014 7:39 pm
by jarid3421
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 is, when I keep issuing the request it keeps appending over and over again, http://i.imgur.com/nKCvgKn.png

Code: Select all

if (oSession.uriContains("q=")) 
{
    var str = oSession.fullUrl;
    var sAppend = "+test1+test2+test3";
    if (!oSession.uriContains(sAppend))
    {
        oSession.fullUrl = str.replace( "q=","q="+sAppend);
    }
}
Can you please give me an example? I'm still new to programming.

Thank you

Re: How do I append a string to search query only once ?

Posted: Mon Sep 22, 2014 10:27 am
by phpdeveloper1
jarid3421 wrote:..............................
The problem is, when I keep issuing the request it keeps appending over and over again, http://i.imgur.com/nKCvgKn.png
Have you tried

Code: Select all

    oSession.fullUrl = str.replace( "/q\=.*?/","q="+sAppend);