Skip to main content
Question

Formula for Deleting Lines of Text

  • December 29, 2025
  • 5 replies
  • 135 views

Forum|alt.badge.img+2

A couple months back, I asked for help deleting lines of text beginning with the word ‘Highlight’ and was given this great formula:

 

REGEX_REPLACE(

{Hook},

".*Highlight.*\\n\n?",

""

)

 

It has been a huge time-saver but something I forgot to ask with my original question is if there is a way to add a blank line/line break where those lines were. I input data into the records that looks like:

Highlight(blue) - Page 34 · Location 290

“Look at that. That thing’s almost a book.”

Highlight(yellow) - Page 34 · Location 292

“You think… she’s going to print it? When it’s done?”

Highlight(pink) - Page 34 · Location 294

“I hope so,” I say as brightly as I can manage. 

 

And when using the current formula, it comes out like:

“Look at that. That thing’s almost a book.”

“You think… she’s going to print it? When it’s done?”

“I hope so,” I say as brightly as I can manage.

 

But I need blank lines where the lines starting with ‘Highlight’ were so it looks like:

“Look at that. That thing’s almost a book.”

 

“You think… she’s going to print it? When it’s done?”

 

“I hope so,” I say as brightly as I can manage.

 

I’ve tried using the AI assist and formula generators to add blank lines or adjust the formula to add a blank line but it always gives me an error so I’m hoping someone may know how to adjust the formula to accomplish this. 

5 replies

ScottWorld
Forum|alt.badge.img+35
  • Genius
  • December 29, 2025

You would just need to change your formula to this:

REGEX_REPLACE(
{Hook},
".*Highlight.*\\n\n?",
"\n"
)

- ScottWorld, Expert Airtable Consultant


Forum|alt.badge.img+2
  • Author
  • New Participant
  • December 29, 2025

You would just need to change your formula to this:

REGEX_REPLACE(
{Hook},
".*Highlight.*\\n\n?",
"\n"
)

- ScottWorld, Expert Airtable Consultant

That worked perfectly, thank you so much! 


Forum|alt.badge.img+4
  • Participating Frequently
  • January 6, 2026

Nice formula, I’ve always found regex is always tricky so it is good to have some formulas to reference to make regex much easier.


Forum|alt.badge.img
  • Participating Frequently
  • April 2, 2026

Regex in Airtable formulas always feels like defusing a bomb until suddenly it clicks — swapping the replacement string to "\n" instead of "" is one of those solutions that's obvious in hindsight but genuinely not obvious when you're staring at it. ScottWorld saves the day again, that guy answers half the formula questions on this forum.


Forum|alt.badge.img
  • New Participant
  • April 6, 2026

For anyone looking for a great regex resource, I recommend https://regex101.com/. It's a workspace to build and test expressions. You can create a user profile so you can save them for future reference too. There's even a whole library of expressions created by the community.

 

Super cool!