Hi, my macro replaces the mandatory citation from iBooks excerpts. While this is a handy feature in some situations, it isn't helpful for e.g. looking copied text up on the web.
They look like this (German system language):
„Behold my recurring nightmare: Are we, too, missing some basic pieces of the universe that once were? What part of the cosmic history book has been marked “access denied”? What remains absent from our theories and equations that ought to be there, leaving us groping for answers we may never find?“
Auszug aus: Neil DeGrasse Tyson. „Astrophysics for People in a Hurry.“ iBooks.
The result of my macro should be:
Behold my recurring nightmare: Are we, too, missing some basic pieces of the universe that once were? What part of the cosmic history book has been marked “access denied”? What remains absent from our theories and equations that ought to be there, leaving us groping for answers we may never find?
Yes to both. I'm sure there's more than one way to tackle the problem, but here's one that will allow you to replace four of your Search and Replace actions with a single Search Using Regular Expression action:
Quite usefully, as well, you'll now have the different components of the citation stored in their own variable: Excerpt being the one to which your question directly pertains, containing only the quote with the speech marks and iBooks reference stripped away; Author, which will store the name of the author as given by the iBooks reference; and Title, which will store the title of the book from the iBooks reference.
Here's the regular expression I used:
^„(.*)“[\r\n]*Auszug aus: (.*)\. „(.*)\.“ iBooks.
(You'll have to make sure the characters used to match quote marks are the correct ones. I did a direct copy-n-paste from your post into KM, and those were the symbols that were used.)
Thank you for your recommendations. Storing text in different variables opens more possibilities (although I don't need it right now) and the regular expression is much more elegant than my solution.
The regex works at regex101.com (https://regex101.com/r/roRz7M/1/) with $ at the end, but in the KM macro only without. (Like in your screenshot). This shouldn't be an issue however.