regex for MMMM yyyy

I need a JavaScript regex for full month name and 4 digit year. So February 2015 would pass but not Feb 2015 or 02/15.
This is what I have. The month part seems to be working but the year is not.
var thedayPattern =/^\b{?:January?|February?|March?|April?|May|June?|July?|August?|September?|October?|November?|December}\s\d{4}$/;
	if(thedayPattern.test(document.getElementById("startDate").value))
	{
		alert("yes");	
		return false;
	}
	else
	{
		alert("no");
		return false;	
	}

Open in new window


 February 201 is going through as passing, but it should go into the fail since it is not in yyyy format.
spectrumcareAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ozoConnect With a Mentor Commented:
/^(January|February|March|April|May|June|July|August|September|October|November|December)\s\d{4}$/
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
You are returning false twice. The second one should be true if no means that your test was OK. Or the other way around if you prefer.
0
 
spectrumcareAuthor Commented:
This worked great. Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.