Javascript RegExp Matching weirdness
<p>I have a <code>RegExp</code>:</p>

<p><code>/.?(NCAA|Division|I|Basketball|Champions,|1939-2011).?/gi</code></p>

<p>and some text <code>"Champion"</code></p>

<p>somehow, this is coming back as a match, am I crazy?</p>

<pre><code>0: "pio"
1: "i"
index: 4
input: "Champion"
length: 2
</code></pre>

<p>the loop is here:</p>

<pre><code>// contruct the pattern, dynamically
var someText = "Champion";
var phrase = ".?(NCAA|Division|I|Basketball|Champions,|1939-2011).?";
var pat = new RegExp(phrase, "gi"); // &lt;- ends up being 
var result;

while( result = pat.exec(someText) ) {
     // do stuff!   
}
</code></pre>

<p>There has to be something wrong with my RegExp, right?</p>

<p>EDIT:
The <code>.?</code> thing was just a quick and dirty attempt to say that I'd like to match one of those words AND/OR one of those words with a single char on either side. ex:</p>

<pre><code>\sNCAA\s
NCAA
NCAA\s
\sNCAA
</code></pre>

<p>GOAL:
I'm trying to do some simple hit highlighting based on some search words. I've got a function that gets all of the text nodes on a page, and I'd like to go through them all and highlight any matches to any of the terms in my <code>phrase</code> variable.</p>

<p>I think that I just need to rework how I am building my RegExp.</p>
