Trim trailing white spaces in source code

Is there an option or function to trim trailing white spaces from source code, while or after typing, or when exporting DDL?

There is a regular expression you could use for that, but I don't know of any other way.

Text to find: ([^ \t\r\n])[ \t]+$
Replace with: \1

It would be a useful option. I have seen developers take exported DDL scripts and strip the trailing whitespace using Notepad++.

1 Like

Being "lazy", I was hoping Toad editor would have a "Right-click" -> "Remove Trailing Blanks" :slight_smile:

This all seems rather clunky, though. Couldn't there be an option in TOAD to remove trailing whitespace on load or compile or save? I suppose formatting removes trailing spaces, but what about removing spaces without formatting?

But, there is this: Code that is under CM that has had previously existing whitespace stripped by a dev who just actually changed a single line could 'fool' the CM tool into thinking EVERYTHING changed instead. It may be that some CM software is smart enough not to be fooled but probably not all are.