How to auto tidy text?

The Texts are copy from web or OCR , but after pasting into the coda doc. See…

There’s a lot of blank space.

Every time I have to manually delete blank space to tidy format.

So, How to auto tidy text in Coda or other text software ( Notepad ++ or ??)

Thanks.

You can replace all vertical space \n or \r\n with a horizontal simple space " " in Notepad++ or whatnot. But then you’ll have the problem that the whole text will be one long paragraph.

Usually OCR software would detect true paragraphs vs simply starts of new lines for you.

You can also come up with some more advanced replacement logic that e.g. if a line is significantly shorter (by char count) than usual, then keep the new paragraph. E.g. with regex like replacing (?<=[^\n]{30,})\n+ -> " ", you will only remove newlines if there were 30 or more characters in that line.

3 Likes

Oh ! The idea is replace blank space/tab with Regex in Notepad ++

Thanks so much !!!

Or you can put it in a cell and replace with RegexReplace() into another cell, right in Coda.

2 Likes

I found another solution in Notepad ++ , one click

I set shortcut in Shortcut mapper .

By the way, If coda have this one click solution , that’s great !!!

1 Like