aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-09 06:35:58 +0900
committergit <svn-admin@ruby-lang.org>2022-02-25 19:52:29 +0900
commitc8cddac45c3786afc737ac9c1075d77d8f752d3d (patch)
tree60bde0499abc5ed7c474bcc9a676400a46452677 /ext
parent9f59a2bd877061594b4af624fe76cc32f9743438 (diff)
downloadruby-c8cddac45c3786afc737ac9c1075d77d8f752d3d.tar.gz
[ruby/date] Use possessive match
Reduce backtracks at the same character classes arounding an optional pattern. https://github.com/ruby/date/commit/1fd15f7c49
Diffstat (limited to 'ext')
-rw-r--r--ext/date/date_parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 91e294e4aa..0e7067f4d8 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -922,8 +922,8 @@ parse_us(VALUE str, VALUE hash)
COM_FPT
#endif
"(?:"
- "\\s*,?"
- "\\s*"
+ "\\s*+,?"
+ "\\s*+"
#ifndef TIGHT_PARSER
"(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
"\\s*"