How do I insert a variable into a regexp that gets executed using the search method?
<p>.search JS method seems to want a string literal not a variable… </p>

<pre><code>for (app in Servers)
{
    the_name = Servers [app]["Name"];
    the_app = Servers [app]["App Name"];
    search_str = "/"+Name+"/";
    hit = the_app.search(search_str);
    if (the_name == Name || the_app == "Foo Bar" )
    {
        result.Index = app;  
    }
}
</code></pre>

<p>I want to generate a hit for a set of Apps that have a common Word for e.g. Name = "Skittles" will hit on Apps where app_name == "Skittles 1.0"; "Skittles 1.5"; "Skittles 3.2 — The Deluxe Edition 3.2"; etc etc</p>

<p><em>Name</em> is a user definable variable. <em>Servers</em> is an object made available to me that lists video servers I can stream from running on my machine, each item in <em>Servers</em> will correspond to a server and have a "Name" item and a "App Name" item in it's object. (It's <a href="http://syphon.v002.info" rel="nofollow">Syphon</a> thing this is not an HTML/web context). </p>

<p>Should I look at using a different method to construct the regexp?</p>
