View Single Post
Old 08-02-2021, 02:07 PM   #546
Twirlip
Junior Member
Twirlip began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2021
Device: Kindle Paperwhite Gen 7
I've modifed import list for myself, so if it finds a "\n" in the regex, it uses Python's finditer to repeatedly find matches, instead of going line by line. I also updated the handling of custom fields, as it didn't work for me when using the clipboard source. I can now use this regex to parse my text:

Code:
^.*\.\.\.\n(?P<title>.*)\n(READ\n)?(Update Available\n)?(?P<authors>.*\D(?=\d?\d \w+ \d{4}))(?P<#purchased>\d?\d \w+ \d{4})\n\d+$
As a simpler example, if I have text formatted as title then author on separate lines, like this:

Quote:
Pride and Prejudice
Jane Austen

To Kill a Mockingbird
Harper Lee
Then this expression works:

Code:
(?P<title>.+)\n(?P<authors>.*)\n*
If anyone wants to try my version, here it is:
Attached Files
File Type: zip Import List_1.5.6_plus_clipboard_multiline_regexes.zip (498.9 KB, 342 views)
Twirlip is offline   Reply With Quote