View Single Post
Old 12-22-2021, 05:35 PM   #8
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by lomkiri View Post
You want to see if your acro is at the end of a paragraph (A.B.</p>) or of a sentence (A.B. Then something) or if the is a word in lowercase

I propose you a regex function, working with this regex :

See if you want to consider other cases. Notice that, e.g., A.B. Lda will give AB. Lda, because of the capital letter of the next word
Thanks

This looks a LOT easier than the brute force way I tried

I can single step through and address the A.B. Lda case

Code:
 <!-- CASE 1
      TRAILING SPACE FOLLOWED BY CAPITAL LETTER SO ASSUME END OF SENTENCE
      AND LEAVE LAST PERIOD -->
  <!-- CASE 2
        NO TRAILING SPACE SO ASSUME END OF PARAGRAPH 
        AND LEAVE LAST PERIOD -->
  <!-- CASE 3
        HAS TRAILING SPACE SO ASSUME IN MIDDLE OF SENTENCE WITH NO PERIODS -->
I have 3 cases and your function works great on case 1 and case 2. Doesn't seem to do anything for case 3. Can you tweak it a little for me please?
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	105
Size:	113.3 KB
ID:	190965  
Attached Files
File Type: epub Acronyms.epub (1.9 KB, 110 views)

Last edited by phossler; 12-22-2021 at 05:40 PM.
phossler is offline   Reply With Quote