find howmany words are starting with given search string - Regex
<p>I am working on regex for searching hotel list. There are names like "testing hotel plaza",  "testing2 newhotel plaza", "plaza hotel"....</p>

<p>basically my requirement is if user type plaza then all the hotels should populate which contains "Plaza"....but if user types "aza" no result should populate. In short in given string I need to find is there any word that start with user entered string and if yes, then display the result...Please advice</p>

<p>here is a code that I am stuck and is not working...</p>

<pre><code>var regex = new RegExp("/\b"+searchString, "gi");
    if (mainString.match(regex))
    {
        return true;
    }
</code></pre>

<p>This is working but it is finding all occurance even if it is a middle character or at any position..which I do not want</p>

<pre><code>    var regex = new RegExp(searchString , "gi");
    if (mainString.match(regex))
    {
        return true;
    }
</code></pre>
