Extracting an "encompassing" string based on a term within the string
<p>I have a java function to extract a string out of the HTML Page source for any website...The function basically accepts the site name, along with a term to search for. Now, this search term is always contained within javascript tags. What I need to do is to pull the entire javascript (within the  tags) that contains the search term.</p>

<p>Here is an example - </p>

<pre><code>&lt;script type="text/javascript"&gt;
    //Roundtrip
    rtTop = Number(new Date());

    document.documentElement.className += ' jsenabled';
&lt;/script&gt;
</code></pre>

<p>For the javascript snippet above, my search term would be "rtTop". Once found, I want my function to return the string containing everything within the script tags.</p>

<p>Any novel solution? Thanks.</p>
