Is there an function to identify extra spaces between words?

Marco_13112001
edited December 2023 in General

Hi,

I would like to check if is there any out of box solution for identification of extra spaces between words.

Thanks

Tagged:

Best Answers

  • Henry Simms
    Henry Simms Administrator
    Answer ✓

    HI @Marco_13112001 . If you just wanted to remove repeating whitespace, the Compact Spaces function should do the job. For just flagging multiple whitespace characters between words I would consider the Matches Expression function using a Regular Expression to identify the patterns you're interested in.

  • Danny Roden
    Danny Roden Administrator
    Answer ✓

    Hi @Marco_13112001, I was recently doing something similar and used the following regular expression [ ]{2,}

    The above function matches to any occurrences of 2+ space characters in succession and replaces with a single space.

    You can also easily tweak this to match to another character too, for example the comma character, by changing the expression to [,]{2,} which is handy for (in my case) finding empty values in a list within a cell (and then converting them to a comma to effectively remove them)

    You can also easily tweak this expression to match to exactly 'n' occurrences of a character, by removing the comma from within the {curly brackets} e.g. [,]{10} find any examples of exactly 10 consecutive space characters

Answers