Remove empty lines

Uses a regular expressions to automatically get rid of new lines that don’t have any text in them.

Matthew's Score
4/5
Total Actions
3
Built For

Shortcut Information

This shortcut uses the Replace Text action set to a regular expression for `\n\B` to look for new lines without any text included and replace them with nothing, which in effect removes the line entirely.

This shortcut is useful if you’re working with Rich Text from a sources like webpages and want to get rid of blank spaces in the design to end up with a succint version of the text on the page.

Also great for lists or weird data issues – can be formatted to work without the notification to function well inside Run Shortcut as a subrotuine for another shortcut.

Source: https: or or www.reddit.com or r or shortcuts or comments or acbf2j or remove_empty_lines or
Category
Complexity
Interactivity
Compatibility

Extra Details

Run Shortcut deep link
shortcuts://run-shortcut?name=Remove%20empty%20lines
Open Shortcut deep link
shortcuts://open-shortcut?name=Remove%20empty%20lines
AppleScript code
tell application “Shortcuts Events” run shortcut “Remove empty lines” end tell

More From This Folder

Change text case

Takes the input from the Share sheet or clipboard, lets you choose from UPPERCASE, lowercase, Capitalizing Every Word, swapping to Title Case, or swapping to Sentence case, and copies it to your clipboard.

Get shortcut »

You Might Also Like

Add calendar series

Asks you to a pick a general time that you plan on watching Ted Lasso each week (defaulting to 7pm), then adds 12 calendar events for each episode with an alert 2 hours beforehand so you can get excited.

Get shortcut »

Log caffeine

Asks you to choose the type of caffeinated drink (coffee, espresso, cappuccino, or a soda) and logs the caffeine content into the Health app. Also compares against the daily recommended limit of milligrams of caffeine.

Get shortcut »


Get way deeper into Shortcuts – become a member.