Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-01-2015, 05:02 AM
loes loes is offline Windows 8 Office 2013
Novice
 
Join Date: Apr 2015
Posts: 1
loes is on a distinguished road
Default regular expressions in footnotes

I have two long documents, with many footnotes, that need to be formatted. Both documents present a different problem in the footnotes, which I would like to solve using a regular expression.

1. Punctuation sign (full stop) missing at the end of a footnote.
I use the following regular expression:
find (search all footnotes that do not end with a punctuation sign), use wildcards activated: ([!.\?\!])(^13)(^2)
replace (add full stop at the end of footnotes not ending with a punctuation sign): \1.\2\3
The regular expression finds the footnotes that should be corrected without any problems, but does not do anything when pressing 'replace', nor 'replace all'.

2. Footnotes separated by a white line, i.e. additional hard return.
I use the following regular expression:


find (search all footnotes that are separated from the next one by an additional hard return), use wildcards activated: (^13)(^13)(^2)
replace (remove one of both hard returns): \2\3
The regular expression, again, finds the footnotes that should be corrected without any problems, but does not do anything when pressing 'replace', nor 'replace all'.

I have the impression the paragraph mark is blocking both regular expressions (looks like Word is thinking I am replacing the paragraph mark at the end of the footnote, which is not allowed). Can anyone confirm this idea and offer some help how to solve it?

Thanks in advance!
Reply With Quote
  #2  
Old 06-05-2015, 11:03 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,648
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

For 1:
Unless your footnotes have paragraphs that shouldn't terminate in a punctuation mark, you should be able to use -
Find = ([!.\?\!])(^13)
Replace = \1.\2

For 2:
For empty footnote paragraphs, except where the footnote ends with an empty paragraph, you should be able to use -
Find = (^13){2,}
Replace = ^p

Because you can't replace the final paragraph break in a footnote or endnote, there is a limit to what can be achieved via Find/Replace. A macro, however, could be used to iterate through each footnote and do the required processing.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular expressions for text with complex formatting Kreol2013 Word VBA 1 04-12-2013 07:33 PM
Regular Expressions: match words within quotes? tinfanide Word VBA 3 02-02-2013 10:07 PM
regular expressions for empty lines eNGiNe Word 1 01-21-2013 06:38 AM
Regular expressions: lower case after hyphen SusanG Word 2 06-06-2012 11:58 PM
Regular Expressions: [!0-9] does not work??? tinfanide Excel Programming 4 05-30-2012 04:09 AM


All times are GMT -7. The time now is 03:47 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft