View Single Post
 
Old 08-07-2020, 06:17 PM
John 4 John 4 is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Oct 2019
Posts: 69
John 4 is on a distinguished road
Default

Thanks Andrew,
That book is very useful indeed. I've discovered from it that I can replace the first "expression" or "group" (the part within the paragraph marks) with:
[!^13]@

so that instead of:
([A-Za-z ,.;:’\?0-9\!\-”\(\)]{3,200})(\[edit\])

I can use:
[!^13]@(\[edit\])

to achieve the same (or better). I've a feeling I'll be using "@" a lot more often than previously. And I've realised I can use "^p" in the replace box with wildcards, which simplifies things a little.

So that’s the wiki subheadings (and similar problems) definitely taken care of. For the benefit of others, here’s my journey to finding the solution to my main problem: selecting a quotation followed by a citation (including the open speech marks of the quote) but excluding anything before the quote:

Finding the quote is easy because it’s always followed by an “open brackets” or “(”. Considering how simple the code was for the Wikipedia subheadings, I had hoped something like the following would work:
[“{1}]@\(Citation\)

(I hadn't properly considered what the @ means - it finds re-occurrences of the previous character). As you can see I tried to select everything before the citation and limit it to only one “open speech marks” so that the selection stops at the beginning of the quote. Unfortunately it doesn’t work. It only selects “open brackets” that are immediately preceded by an “open speech” which obviously doesn’t occur very often and is useless to me (and almost everyone I would think). So I tried the following:

[“{1}A-Za-z ,.;:’\?\!\-”^2]@\(Citation\)
Neither did this work. It doesn’t recognise the limit I’ve tried to set (only one “open speech marks”), and instead selects everything before the citation until the preceding paragraph mark. So the “@” is extremely useful, but if not used properly it behaves similar to the asterisk and overrides everything.

Finally I discovered a code that works:
“[A-Za-z ,.;:’\[\]\?0-9\!\-”^2]@\(citation\)

As can be seen, almost every possible character is contained between the square brackets, so there should be very few quotes that aren’t covered by the code. The "open speech marks" is put before and outside the square bracketed section so that it's not affected by the "@"

Perhaps that will be of use to someone.
Thanks again for letting me know about that book.

[Edit: Considering it a little further I can see that the exclamation mark is a very important wildcard as well. I hadn't appreciated that fully]

Last edited by John 4; 08-08-2020 at 12:51 AM.
Reply With Quote