distal-attribute
distal-attribute
distal-attribute
distal-attribute

replace commas of sql with newlines

User, date Message
Written by michaelgangMoney, Euro
3 years ago
Category: General
45 posts since Wed, 17 Nov 10
I tried to use the editor ctrl+r with regular expressions to replace commas with new lines.
i tried \n and \\n and it did not work.
how can i do it?
Written by kalvaro
3 years ago
587 posts since Thu, 29 Nov 07
I can confirm it's not working as expected. If you use \n in a replacement expression you n as replacement.
Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
The replacement string is never a regular expression, and things like \n \t and maybe more should be usable with or without having the regular expression option activated. Found this issue report for Lazarus, which probably helps me with some code change for SynEdit.
Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
Not so easy as that might seem. Thought I just string-replace these \n with a real #13#10 right before replacement is processed. Now, TSynMemo.SearchReplace does this when I replace commas with newlines:
original:

TSynMemo wrote: 1,2,3,4


replaced:

TSynMemo wrote: 1


2,3,4



Looks like a bug in SynEdit.
Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
Looks like SynEdit always processes only the number of lines which is found in the original text:

TSynEdit wrote: 1,
2,
3,
4,
5,
6,
7


is replaced with:

TSynEdit wrote: 1

2

3

4,
5,
6,
7

Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
Hm, looks as if even Lazarus still has the above mentioned issue with the number of processed lines. Think we need a different, working approach here. Fixing SynEdit does not seem realistic to me.
Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
Done in r3928, supporting \n and \t now. Accepting the above bug in SynEdit, which is the same as in other applications, e.g. PSPad. The user has to use backward search to overcome that bug.
Written by michaelgangMoney, Euro
3 years ago
45 posts since Wed, 17 Nov 10
That's cool :-)
I am just asking myself, if i make replace all with a regular expresssion, that the program should automatically replace everything backwards?
Maybe a suggestion.
Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
Again, please note that \n and \t are not part of the regular expression feature.

Your suggestion is to automatically check the "backwards" radio button when the replacement string contains \n and "replace all" is clicked. Well, why not.
Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
Done in r3929
Written by michaelgangMoney, Euro
3 years ago
45 posts since Wed, 17 Nov 10
Vielen Dank !!!
Written by ansgar
3 years ago
4940 posts since Fri, 07 Apr 06
Danke dir für die gute Idee - hatte bereits graue Haare wegen des SynEdit Bugs und dann so eine einfache Idee, super.
Written by michaelgangMoney, Euro
3 years ago
45 posts since Wed, 17 Nov 10
smile
 

Please login to leave a reply, or register at first.