title: Regex for date, match this year months plus december of previous year and january of next year
body: <p>Hello i'm trying to write a regex that would match all the month names in a string by this criterium:</p>
  
  <ul>
  <li>if string contains just the month name than it's valid</li>
  <li>if the string contains the month name and starts/ends with year, then the year has to be the current year, but it has to also match december of previous year and january of next year
  </ul>
  
  <p>through example:</p>
  
  <pre>
  june - valid
  june 2014 - valid
  2014 june - valid
  june 2013 - invalid
  june 2015 - invalid
  
  december - valid
  december 2013 - valid
  december 2015 - invalid
  
  january - valid
  january 2015 - valid
  january 2013 - invalid
  </pre>
  
  <p>i use the following regex:</p>
  
  <pre><code>^(?:2014\s*|2015\s*(january)|2014\s*(december)|)(january|february|march|april|may|june|july|august|september|october|november|december|)(?:\s*2014|(december)\s*?2013|(january)\s*?2015|)?$
  </code></pre>
  
  <p>but it gives me "" as a result when i try <em>january 2015</em></p>
  
  <pre><code>array(6) {
    [0]=&gt;
    string(11) "january 2015"
    [1]=&gt;
    string(0) ""
    [2]=&gt;
    string(0) ""
    [3]=&gt;
    string(0) ""
    [4]=&gt;
    string(0) ""
    [5]=&gt;
    string(6) "january"
  }
  </code></pre>
  
  <p>or if i try <em>2015 january</em></p>
  
  <pre><code>array(4) {
    [0]=&gt;
    string(11) "2015 january"
    [1]=&gt;
    string(6) "january"
    [2]=&gt;
    string(0) ""
    [3]=&gt;
    string(0) ""
  }
  </code></pre>
  
  <p>so then i have to ignore all the empty values and find the correct one</p>
  
  <p>Can you guys help?</p>