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

irafee1973
irafee1973 Registered Posts: 2 ✭✭✭✭
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

Answers

  • AdrienL
    AdrienL Dataiker, Alpha Tester Posts: 196 Dataiker

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

  • AdrienL
    AdrienL Dataiker, Alpha Tester Posts: 196 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.
  • irafee1973
    irafee1973 Registered Posts: 2 ✭✭✭✭
    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
Setup Info
    Tags
      Help me…