How to insert spaces in between abbreviated Strings A.B.C. to A. B. C.

irafee1973
Level 1
How to insert spaces in between abbreviated Strings A.B.C. to A. B. C.
How do I reformat abbreviated string that has not yet have spaces in between them and how do I ensure that those already with spaces that it does not add additional spaces. For example A. B.C. Company LTD to A. B. C. Company LTD
0 Kudos
3 Replies
AdrienL
Dataiker

You can for instance use a regex replacement of \b([A-Z]\.)(?=[A-Z]\b) by $1  (there is a space after $1).



0 Kudos
AdrienL
Dataiker
\b states that there was a word limit before the letter (so it wasn't preceded by another letter)
([A-Z]\.) captures the uppercase letter in group #1
(?=[A-Z]\b) is a non-consuming "lookahead" assertion that makes sure that it's followed by another single uppercase letter. You can replace it with (?!\s) if you just want to assert that it's not followed by a space (e.g. if you want to also replace in "A. B. C.Company" by "A. B. C. Company")
Replace by "$1 ", the group #1 + a space.
0 Kudos
irafee1973
Level 1
Author
Hi Adrien i tried it but didnt work.. I did upload a screen shot but now i dont know where it goes. Ill upload the same question again separately with a screen shot
0 Kudos