Import Pattern for Kindle Paperwhite 5.3.1

This pattern addresses another date-time issue.  A file from the Paperwhite was provided that include date-times in the following format:

Added on Monday, 23 April 12 22:51:41

While this is roughly the same date-time pattern found in the previous GMT example, it was necessary to make more significant changes to the expression around the Date tag.  In previous patterns we could depend on AM/PM or GMT to clearly indicate the last characters in the date-time.  This pattern has no obvious terminator.  Instead, we had the time tag include everything up to the end-line characters “\r\n”.  The regex pattern [^…] tells the system to include all characters up and until  the characters listed in the area indicated by the ellipsis.

Notes delimiter:

==========

Notes pattern:

# Import notes and highlights from "My Clippings.txt" and ignore
# bookmarks. Warnings with information on ignored bookmarks
# will be added to the log - this is the app normal behaviour

# Note that VERBOSE and UNICODE options are always on

^\s* #
(?P<Book>.*?) # Book name
(\s*\((?P<Author>[^\(]*)\))? # Author name (optional)
\s*-\ Your\ #
(?P<Type>(Highlight|Note|Bookmark)) # Clipping type - 'Highlight' or 'Note'
(\ on\ Page\ #
(?P<Page>[\d-]*)\ \|)? # Page (optional)
(.*(Location|Loc\.)\ #
(?P<Location>[\d-]*))? # Location (optional)
.*?Added\ on\ #
(?P<Date>([^\r\n]*)) # Date & time
\s* #
(?P<Text>.*?) # Text
\s*$ #

Date Format:

%A, %d %B %y %H:%M:%S

Encoding:

UTF-8 (all languages)

Comments are closed.