I've got a problem using a regex to match the date in a string. Actually I've got a lot of "date formats" to match but the first one doesn't work and I don't get why it wouldn't work...
The format is like "September 12, 2013" or "May 6, 2014" or "June 02, 2014"...
In my string text, there is the following date : "July 4, 2014".
Here's my code :
Pattern p = Pattern.compile("[a-zA-Z]+ [0-3]?[0-9], (1|2)\\d{3}", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(text);
System.out.println(m.group(1));
But it comes to this error :
Exception in thread "main" java.lang.IllegalStateException: No match found
I even tried with smaller regex but it still doesn't match anything.
Thank you in advance for the help !