[LH3581] Project replace with regex hangs Scrivener

Scrivener 2.9.0.16 on Windows 10.

I’m trying to globally remove blank lines by doing Edit / Find / Project Replace then specifying Replace value of ^$ with nothing in the With field. I’ve selected RegEx from the dropdown. Hitting Replace then pauses for a sec then the dialog changes to Project Replace (Not responding) and the app hangs.

Tried the replace in selected document only as well as all docs, Same result.

Hi,

^$

/^$/ is a very weird reg exp… Maybe you should try something like /^\r?\n$/.

Or even /\r\n(\r\n)+/ replaced with ‘\r\n’.

Hope it helps.

It’s pretty standard actually.

Unfortunately no amount of playing with \r, \r\n, \n, with or without // seems to make the replace function do anything.

We don’t talk about « standard » or not, here :wink:. Your reg exp means « a string which contains nothing ». « ^ » means the start of the string and « $ » means the end of the string. An empty paragraph does not contain « nothing ».

« / » just means: “I write a reg exp in my post, not a string”. You don’t have to write them in the research field…

Is it clearer ? (sorry for my bad english)

On mac, this works like a charm:


Search for: (\n)\n+

Replace with: $1

Not on Windows unfortunately. Does nothing.

Hi @bob.f,

It is quite possible that the devs haven’t yet completed the code to implement RegEx in Windows 3. It might b worth trolling through the release notes in the beta download thread to see if there’s any mention. Like Philicare, I’m a Mac user, but I keep a track of the Windows development, because my collaborator is a Windows user currently using Beta 16. However RegEx hasn’t reared its head for us.

:slight_smile:

Mark.

This has been filed, Thanks.

Just to clear up some confusion for those following along at home, the difference between $ and \r\n (or \n or \r depending on your OS newline standard) is that while $ matches up to your end of line character(s), it doesn’t include them. Specifying them explicitly includes them in the match (and then in the replacement).