Is there a way to insert newlines (`\n`) in Replace?

Hi there,

I’ve been wondering if it’s possible to insert \n (newline) characters using Search and Replace? They are currently inserted as literals only.

I’m assuming this just isn’t supported? But it would be great!

Jupyterlab 4.2.5.

Thanks in advance!

Jeremie

Just use ctrl + enter:

If I choose to replace all in

image

it becomes

as expected.

(jupyterlab 4.5.1)

welcome to the forum

1 Like

I don’t know if this a machine/browser specific thing? Or did it break and only get fixed in v4.5.1?
I am trying that on a Mac in JupyterLab v4.4.9 (available here) in Chrome and not seeing that replacement happen like you show.

Silly me, that was weirdly counterintuitive (the regex brain at work), but I can confirm it works in Jupyterlab 4.2.5! Thanks!

2 Likes

I never use this, so I cannot say since when this was implemented or if it was broken, but it works on Linux and Windows in Chromium based browsers.

1 Like