Coming soon: We’re working on a brand new, revamped Community experience. Want to receive updates? Sign up now!

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

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).

\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
1,339 questions
1,365 answers
11,916 users

©Dataiku 2012-2018 - Privacy Policy