summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/date/date_parse.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 5fa036ed72..91e294e4aa 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -652,24 +652,27 @@ parse_time(VALUE str, VALUE hash)
{
static const char pat_source[] =
"("
+ "\\d+\\s*"
"(?:"
- "\\d+\\s*:\\s*\\d+"
"(?:"
+ ":\\s*\\d+"
+ "(?:"
#ifndef TIGHT_PARSER
- "\\s*:\\s*\\d+(?:[,.]\\d*)?"
+ "\\s*:\\s*\\d+(?:[,.]\\d*)?"
#else
- "\\s*:\\s*\\d+(?:[,.]\\d+)?"
+ "\\s*:\\s*\\d+(?:[,.]\\d+)?"
#endif
+ ")?"
+ "|"
+ "h(?:\\s*\\d+m?(?:\\s*\\d+s?)?)?"
+ ")"
+ "(?:"
+ "\\s*"
+ "[ap](?:m\\b|\\.m\\.)"
")?"
"|"
- "\\d+\\s*h(?:\\s*\\d+m?(?:\\s*\\d+s?)?)?"
- ")"
- "(?:"
- "\\s*"
"[ap](?:m\\b|\\.m\\.)"
- ")?"
- "|"
- "\\d+\\s*[ap](?:m\\b|\\.m\\.)"
+ ")"
")"
"(?:"
"\\s*"