I use the find an replace bar at the bottom of the window.
I search for dots which are followed by space ". "
Now i want to replace them by a dot followed by a new line.
I did try to replace with a dot followed by a backslash and n ".\n".
But then it inserts a literal \n instead of a line break.
In the help file i have found no hint on how to find things and replace them by new lines.
There is no variable like $newline or $tab or such a thing.
The editor i have used before hat some kind of popup select menu to insert some special tags into the search and the replace box, that was very handy.
For search it has offered Tags like Tab \t, New line \n, Any Character ., In Range [], Not in Range ^[], Befing of line ^, End of Line $, Tages expression (), Or |, 0 or more matches *, 1 match or more +, 0 or 1 match ?.
For replace it did offer Tab Character \t, New Line \n, Find What text $&, tagged expression $1 ... $9.
It did offer to find replace literal but when checking a checkbox for RegEx to use such expressions.
It also had a mode that did open the same searchbox but instead of single line expressions it did switch to multi line expressions for find and replace
that was very handy
how can i do this in RJ TextEd?
Example:
Line 1, Line 2, Line 3, Line 4, Line 5.
How can i use Find Replace to turn this into the following:
Line 1
Line 2
Line 3
Line 4
Line 5
Find and Replace New-Line
Re: Find and Replace New-Line
You can do the same in RJ TE, just click on the computer icon adjacent to "replace" field, pick "Edit", press Enter in the edit field and click on OK; a pipe symbol will be inserted into "replace" field, denoting newline.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Re: Find and Replace New-Line
Thanks i have found that and it looks great, the computer-symbol opens this multiline panel and in the single line text-box the new-line character turns into a pipe-symbol.pjj wrote: 10 Aug 2026 08:26 [---] just click on the computer icon adjacent to "replace" field, pick "Edit", press Enter in the edit field and click on OK; a pipe symbol will be inserted into "replace" field, denoting newline.
Now i got into some other strange problem:
Given Text:
Code: Select all
Sentence with an ending dot. And one more.
Then a new line. And so on. 123
Before the end.
"\." escape the dots
" " add one space
"()" find an expression to use it later in the replacement
"[a-zA-Z]" find latin letters a-Z after the dot and use them later in the replacement.
\. ([a-zA-Z])
https://regex101.com/ tells me this is valid and uses a capturing group.
I try to replace:
"|" new-line
"$0" the capturing-group
Now i think that the text will turn into the following
Code: Select all
Sentence with an ending dot.
And one more.
Then a new line.
And so on. 123
Before the end.
Code: Select all
Sentence with an ending dot
. And one more.
Then a new line
. And so on. 123
Before the end.
What i get ist this:
Code: Select all
Sentence with an ending dot. Ad one more.
Then a new line
. A so on. 123
Before the end.
This looks more like salad.
I Press the undo button even more, and the salad turns even more into an total soup of some thing.
I use 16.66 beta 4 on Windows, if this matters.
How can i just do this break-line after dot -thing, and hopefully undo it correctly if i dont like it?
Re: Find and Replace New-Line
No, you're clearly searching for a dot, a space and then some Latin letters. To find "sentences", you need to use something like this:ScrKiddle wrote: 11 Aug 2026 23:42 I try to find all sentences with Reg-Ex:
"\." escape the dots
" " add one space
"()" find an expression to use it later in the replacement
"[a-zA-Z]" find latin letters a-Z after the dot and use them later in the replacement.
\. ([a-zA-Z])
Code: Select all
([a-zA-Z ]+)\. ?\n?Code: Select all
$1.\nAlium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Re: Find and Replace New-Line
In an other editor i use this without quotes "\. ([a-zA-Z])".pjj wrote: 12 Aug 2026 08:13 [...]
No, you're clearly searching for a dot, a space and then some Latin letters. To find "sentences", you need to use something like this:
and replace withCode: Select all
([a-zA-Z ]+)\. ?\n?
or maybe \r\n instead of \n in RJ TE. Or a pipe, if it works with regex. -- As for the undo, well, that's a different story and it always was problematic. As well as in other editors, I guess.Code: Select all
$1.\n
This finds a dot after each sentence followed by a space what is the case if there is no new line after the sentence, and followed by the first letter of the next sentence, but not if followed by a number.
then i replace it with the following without quotes ".\n$1".
The difference is, that it will find the point where a sentence ends and an other sentence begins with some letter on the same line, and then it will replace this break-point by the ending dot of the previous sentence and remove the space and replace it with a new-line and the first letter of the following sentence.
The effect may looks the same. every sentence that is not followed by a number will get separated on a new line, but it will not handle the whole sentence, which is may long, but just the dot-space-firstLetter, what needs less resources than to handle the whole sentence.
In the same (other) editor the undo function has absolutely no problem to revert/undo Reg-Ex Find-Replace actions over documents with serval thousands of lines, honestly i never saw such an odd undo-problem in any other editor. The editor offers a limited set of PCRE RegEx "commands".
- Rickard Johansson
- Site Admin
- Posts: 6973
- Joined: 19 Jul 2006 14:29
Re: Find and Replace New-Line
A while back I made changes to how "Replace All" handles linebreaks. When creating a source buffer all line breaks are now converted to LF, instead of using CRLF. So all positions had to be updated since CRLF are 2 characters and LF is only one. This include modifications to the undo functions as well.
But it seems you found a bug in the undo function when using regex that modify lines.
I'll fix it.
But it seems you found a bug in the undo function when using regex that modify lines.
I'll fix it.
- Rickard Johansson
- Site Admin
- Posts: 6973
- Joined: 19 Jul 2006 14:29
Re: Find and Replace New-Line
It's fixed in the next release.
Turns out it was the regex library, used in Delphi. When computing and retrieving the replacement string - all line breaks are CRLF, even if I use a source string with only LF:s.
Anyway, undo should work now...
Turns out it was the regex library, used in Delphi. When computing and retrieving the replacement string - all line breaks are CRLF, even if I use a source string with only LF:s.
Anyway, undo should work now...
