0 votes
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
asked by

1 Answer

0 votes

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

answered by
\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.
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
891 questions
920 answers
1,397 users