Looking to see if there is a RegEx that will help to insert non-breaking spaces to join names, etc. so as to avoid a line wrap in the middle
For example. in the fragment below, I'd like to insert NBS after the 's' and before the "B' so that 'Thomas J. Beale' doesn't line wrap
Quote:
by the name of Thomas J. Beale rode into Lynchburg and checked into the Washington Hotel.
|
I think I'll need two passes
#1 -
A. B. Charles -- > A.nbsB.nbsC
Find: ([A-Z])\. ([A-Z])\. ([A-Z])
Replace: \1.\xA0\2.\3
#2 -
A. Charles --> A.nbsC
Find: ([A-Z])\. ([A-Z])
Replace: \1.\xA0\2
The problem -- If a sentence ends with an upper case letter, it finds it
blah blah end of sentence
T. Next sentence
Is there a better way to do the RE?
Eventually I'd like to extend this to joining dates. Maybe some others
March 22, 2021 --> Marchnbs22,nbs2021