Hi there
Does anyone know if it would be possible to use a Regular Expression to turn all sentences of a document into their own single paragraphs.
I mean (all at once) replace period-space with period-carriage return ;
?-space with ?-carriage return ;
!-space with !-carriage return ;
âŠ-space with âŠ-carriage return.
And if so, would it be then possible to include âfollowed by a capital letterâ as a condition ?
So that â Isnât it so ? he said. â wouldnât split.
Beware: the $2 capture group may not work due to a bug in the RegEx implementation in Scrivener. You could remove ([A-Z]) and $2, but the line without a capital letter in the next sentence will then split.
Thanks Antoni.
Ok. Just tried it out.
It only partially worked :
It introduced \n to where the splits should have been instead of a carriage return.
And it did so even where it wasnât followed by a capital letter.
I just noticed that it actually replaced the space by \n, it did not just add it.
Now I tried with âignore caseâ unchecked :
It is better, the formula now respects the âfollowed by a capital letterâ condition. But it is still just replacing the space following the ? ! . or ⊠by \n.
I donât know what language youâre speaking now. \n is the paragraph break. Carriage return makes it look like separate paragraphs, but theyâre not.
Nope. Iâm fine without an extra space. But thanks for the info.
That is French punctuation.
I know my test sentence is English, but might as well run the test as if French, just in case.
(And yes I do it a lot in my posts too. I find it easier to read. Or maybe Iâm just too used to it. )
I think thereâs confusion because of the difference between Windows and Mac where CR and LF are concerned, but hereâs a simple demo of the difference, on a Mac at least. It may not be relevant to the behavior of Scrivener on Windows, but it is relevant to the meaning of the symbols ¶ and â. In the 1st screenshot, youâll see a few paragraphs separated by ¶s (as always) together with a Find/Replace dialog prepared to replace ¶ with â.
In the 2nd screenshot, you see the result of performing the replace once. The paragraph after it still starts on a new line, but now itâs part of the previous paragraph, which you can see from the fact that it has no indentation.
Indeed, yes. Configurable by the user to add or remove any punctuation points they want.
I personally like the restriction of searching for a single space ( ) rather than white-space \s, which, as I understand things, matches spaces, new lines, carriage returns, and tabs.