Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2020, 09:05 AM
John 4 John 4 is offline Bold all Wikipedia subheadings, without bolding lots of text above them as well. Windows 10 Bold all Wikipedia subheadings, without bolding lots of text above them as well. Office 2016
Advanced Beginner
Bold all Wikipedia subheadings, without bolding lots of text above them as well.
 
Join Date: Oct 2019
Posts: 69
John 4 is on a distinguished road
Default Bold all Wikipedia subheadings, without bolding lots of text above them as well.

Hi,

I’m trying to bold all subheadings in certain Wikipedia articles. I thought this would be fairly straightforward seeing that they’re all followed by “[edit]”. But no matter what I try it won’t limit itself to the desired sub-heading and instead selects lots of text above/before the sub-heading as well. These are examples of the kind of codes I’ve been trying:
^13*\[edit\]
Progressing to things like:
<[A-Z]*[a-z]>\[edit\]

I’ve tried numerous other things so as to limit it to the desired line/subheading, but nothing works. Can one of you tell me what I’m doing wrong? (apart from reading Wikipedia articles).

If you try it out on the following extracts from Wikipedia’s “Western Philosophy” article you’ll see what I mean:

Plato[edit]
Plato was a student of Socrates. Plato founded the Academy of Athens and wrote a number of dialogues, which applied the Socratic method of inquiry to examine philosophical problems…



Aristotle[edit]
Aristotle was a pupil of Plato. Aristotle was perhaps the first truly systematic philosopher and scientist. He wrote about physics, biology, zoology, metaphysics, aesthetics, poetry, theater, music, rhetoric, politics and logic. Aristotelian logic was the first type of logic to attempt to categorize every valid syllogism…

Hellenistic period[edit]
Following Socrates a variety of schools of thought emerged. In addition to Plato's Academy and Aristotle's Peripatetic school, other schools of thought derived from Socratic philosophy included the Academic Skeptics…

============

Thanks for your time.
Reply With Quote
  #2  
Old 08-01-2020, 08:11 PM
Guessed's Avatar
Guessed Guessed is offline Bold all Wikipedia subheadings, without bolding lots of text above them as well. Windows 10 Bold all Wikipedia subheadings, without bolding lots of text above them as well. Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

In my opinion, you are going about this the wrong way.

Try using the 'Autoformat...' button that you can add to your Quick Access Toolbar. This makes short work of what you are trying to achieve.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 08-05-2020, 05:25 AM
John 4 John 4 is offline Bold all Wikipedia subheadings, without bolding lots of text above them as well. Windows 10 Bold all Wikipedia subheadings, without bolding lots of text above them as well. Office 2016
Advanced Beginner
Bold all Wikipedia subheadings, without bolding lots of text above them as well.
 
Join Date: Oct 2019
Posts: 69
John 4 is on a distinguished road
Default

Thanks for your suggestion Andrew. Auto-format can probably be very useful but I doubt that it has the flexibility of knowing how to use find and replace properly. It (find and replace) is an amazing tool and I'd like to be able to use it to it's full potential (or somewhere close to it).

The Wiki articles sub-headings is really only one of numerous similar problems that I often encounter while trying to manipulate documents, so if I could find the answer to this question (if there is an answer), then it would answer a number of other problems I have as well, whereas I think auto-format would be a bit one-dimensional by comparison.

It's the asterisk that is both so useful and at the same time causes so many problems.

For example, I often want to use a quotation as a dividing marker in my "Find" searches. If i want to italicise all quotes it works great: Find: "*" and Replace with: Italics. If i click "Find next" it will skip from one quotation to another perfectly. But if introduce anything else into the "Find", then things can get messy. E.g. the quotes are often followed by a bracketed reference for the quote, but if I try to include the reference in my search then the "*" starts finding lots of text I don't want it to find. It no longer limits itself to one quote and instead starts selecting numerous quotes including lots of unquoted text in between.

I've tried using "*"{1} to limit it to one quote, and also things like "{1}*" hoping that it would limit itself to only one 'open speech marks', but of course the asterisk overrides any limits I try to impose.

I have had some success with codes like the following:
([A-Za-z ,.;:’\?\!\-”]{10,200})
It will select most characters except "open speech marks" (between 10 and 200 characters as you can see), which of course has the effect of (usually) limiting the search to one quotation (minus the "open speech marks" which ideally would be included). That then often requires some extra fixing up afterwards which i was hoping I could avoid if I could find some way to "tame" the asterisk.

Sorry to take up your time. But if you have any suggestions I'd be happy to hear them. I suspect knowing how to write macros would help a lot, but i also suspect that would take quite some effort.

Thanks again
Reply With Quote
  #4  
Old 08-05-2020, 06:54 AM
John 4 John 4 is offline Bold all Wikipedia subheadings, without bolding lots of text above them as well. Windows 10 Bold all Wikipedia subheadings, without bolding lots of text above them as well. Office 2016
Advanced Beginner
Bold all Wikipedia subheadings, without bolding lots of text above them as well.
 
Join Date: Oct 2019
Posts: 69
John 4 is on a distinguished road
Default

In case anyone else has a similar problem to the bolding of the Wikipedia subheadings - here's a code that will take care of almost all of them and remove the "[edit]":

Find: ([A-Za-z ,.;:’\?0-9\!\-”\(\)]{3,200})(\[edit\])
Replace: ^13\1
(Bold)

I added a paragraph mark because many of the subheadings don't have one before them when you paste the article in plain text. But some of them do, in which case you'll sometimes have 3 paragraph marks when you only want two. So to reduce them to two, and unbold them, and change all the ^13 to proper paragraph marks (^p) that don't cause any issues, use:

Find:^13^13^13
Replace:^p^p
(Not Bold)

So that's the Wikipedia problem pretty much sorted. But like I said in the previous post - this wasn't really about Wikipedia articles anyway, it's more about finding a way to limit the asterisk which causes me so many other problems. If anyone can answer that I'd be glad.

Edit: In case anyone's wondering why I didn't use this before - I had been trying to limit the selection to the subheading by using the paragraph mark that comes before it, but know I've realised that by not using the asterisk the selection won't go beyond/before the beginning of the sub-heading. The asterisk of course includes all characters including paragraph marks, which is why it was selecting lots of text that preceded the subheading.

...We're all still learning. Sigh.

Last edited by John 4; 08-05-2020 at 10:54 AM.
Reply With Quote
  #5  
Old 08-05-2020, 04:02 PM
Guessed's Avatar
Guessed Guessed is offline Bold all Wikipedia subheadings, without bolding lots of text above them as well. Windows 10 Bold all Wikipedia subheadings, without bolding lots of text above them as well. Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

If you want to explore what you can do with Wildcard find and replaces, do a search online for Jack Lyon's Wildcard Cookbook. It is now an eBook you can buy and is well worth the money but you can still find freebies if you look hard enough.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #6  
Old 08-07-2020, 06:17 PM
John 4 John 4 is offline Bold all Wikipedia subheadings, without bolding lots of text above them as well. Windows 10 Bold all Wikipedia subheadings, without bolding lots of text above them as well. Office 2013
Advanced Beginner
Bold all Wikipedia subheadings, without bolding lots of text above them as well.
 
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
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bold all Wikipedia subheadings, without bolding lots of text above them as well. How to write a macro for bolding text between quotes jwall Word VBA 3 12-09-2019 10:04 PM
Bold all Wikipedia subheadings, without bolding lots of text above them as well. bold (or unbold) section of text instead of bold toggling Burt Word 6 04-06-2019 09:09 AM
Bold all Wikipedia subheadings, without bolding lots of text above them as well. Custom Slide Master - unable to edit subheadings lubiden PowerPoint 4 02-23-2016 01:48 PM
Bold all Wikipedia subheadings, without bolding lots of text above them as well. Text in #1 is made bold, rest of the document is edited, text in #1 is now not bold footer-assistance Word 1 06-29-2015 03:49 AM
Bolding in script ksigcajun Word VBA 10 02-23-2015 08:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft