Three Char Month and Culture matching in javascript
<p>I have a multi cultural website, where I allow users to enter values in a dd-MMM-yyyy format. I am able to determine the different values based upon their culture in C# (May, English = May, German = Mai) </p>

<p>the problem I am having is the javascript validation of these months. I am able to build the list of acceptable values:</p>

<p>english:</p>

<pre><code>^Jan$|^Feb$|^Mar$|^Apr$|^May$|^Jun$|^Jul$|^Aug$|^Sep$|^Oct$|^Nov$|^Dec$
</code></pre>

<p>German:</p>

<pre><code>^Jan$|^Feb$|^Mrz$|^Apr$|^Mai$|^Jun$|^Jul$|^Aug$|^Sep$|^Okt$|^Nov$|^Dez$
</code></pre>

<p>I just want to make this regular expression case insensitive. but all the references I see are all pointing me to the /gi flag, but I all of the examples make no sense. I have tried the following and it just doesn't work:</p>

<pre><code>var shouldMatch = "may";
var regexPattern = "^Jan$|^Feb$|^Mar$|^Apr$|^May$|^Jun$|^Jul$|^Aug$|^Sep$|^Oct$|^Nov$|^Dec$/gi"
if(shouldMatch.match(regexPattern) != null) {
    //this should happen
}
</code></pre>

<p>What am I doing wrong? the regex help out there for javascript is killing me.</p>
