Applescript + Text Expander to remove line/paragraph breaks

I like copying and pasting in raw text (no formatting), but am finding that it will not strip out line/paragraph breaks. Is there a way to do this from the clipboard via text expander?

This one liner should do it for whatever line break format is being used on your platform.

TextExpander.pasteboardText.replace(/\r?\n|\r/g, "");


Hope that helps.

1 Like

Awesome! Thank you so much. I made a small tweak and had it replace it with a " ")