forked from arrow-py/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unknown tokens in the string are ignored. In the previous implementation, each token was matched individually. With the format 'YYYY-MM-DD', parsing the string '2000 ... 2015-12-31' would fail because 'YYYY' taken alone matches the first 4 numbers. Same with the format 'MMMM YYYY' and the string 'June was born in May 1980'. 'MMMM' would match 'June' instead of 'May' even if there are no digits next to it. This change builds a complete pattern string by replacing each token by its pattern. 'YYYY-MM-DD' becomes '(?P<YYYY>\d{4})-(?P<MM>\d{2})-(?P<DD>\d{2})'. The search is done with that regular expression. That matches '2015-12-31' in the previous example.
- Loading branch information
beenje
committed
Jul 26, 2015
1 parent
8869524
commit a33a1ef
Showing
3 changed files
with
80 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters