Javascript RegExp Object
<p>I use this function below to quickly find an item in a table<br>
My problem is that this function only searches for text that contains the search string in the given table<br>
I have been trying my best to modify it to match only the text that begins with the search string but not working.</p>

<pre><code>function searchTable(inputVal)
{
    var table = $('#supplier_table_body');
    table.find('tr').each(function(index, row)
    {
        var allCells = $(row).find('td');
        if(allCells.length &gt; 0)
        {
            var found = false;
            allCells.each(function(index, td)
            {
                var regExp = new RegExp(inputVal, '^i');
                if(regExp.test($(td).text()))
                {
                    found = true;
                    return false;
                }
            });
            if(found == true)$(row).show();else $(row).hide();
        }
    });
}
</code></pre>

<p>Here is my jquery</p>

<pre><code>        $('#itemname').keyup(function()
    {
        searchTable($(this).val());
    });
</code></pre>
