Thank you all for your reply! @PMario <[email protected]> I actually want to use the filter in real cases! Text is created in Tiddlywiki itself or important from the net. For example Fortran code downloaded from the net and imported into the wiki! Most of these I think were created in the Unix system! So I like to make sure the filter works in all cases.
@Jean-Pierre Thank for the suggestion! I will test it! I do not have a Mac computer but I think I should download text files created in Mac or use Notepad++ to use such newline chars. Best wishes Mohammad On Thu, Apr 29, 2021 at 4:38 PM Jean-Pierre Rivière < [email protected]> wrote: > just to be pedantic, but in old Mac'OS the end of line was only \r. so > your code would not work there > > $list filter="[<source>splitregexp[(\r?\n|\r)]" > > will do that (not tested yet). we obviously cannot use [\r?\n?] > > > Le jeudi 29 avril 2021 à 13:48:01 UTC+2, PMario a écrit : > >> On Thursday, April 29, 2021 at 12:26:23 PM UTC+2 Mohammad wrote: >> >>> It is known that the newline character is different for different OS >>> (see Wikipedia <https://en.wikipedia.org/wiki/Newline>). I am not sure >>> if this is also true for the browsers or not! >>> >> >> 1) If you save a multiline tiddler in TW to the internal store `\n` will >> be used. >> 2) If you copy paste content from a file to TW it will use \n >> >> 3) If you import eg: test.txt from windows there will be "\r\n" in the >> tiddler. >> The next time you edit the tiddler and save there will be "\n" only. >> >> >> >>> Having that said, what is the best practice to treat a newline character >>> in a Tiddlywiki filter to work everywhere! >>> >>> *Case i* >>> >>> <$list filter="[<source>splitregexp[\n]]" ... >>> >> >> So for case 3 it will look like, if it works, but it will keep the \r in >> memory. >> If you want to remove it use: >> >> <$list filter="[<source>splitregexp[\r?\n]]" ... this will always work >> for all OSes. >> >> \r? .. means check for \r optional ... only if it exists >> >> >> >>> *Case ii* >>> <$vars newline=" >>> " > >>> <$list filter="[<source>splitregexp<newline>]" ... >>> >> >> hmm. This won't help since internally we only use \n >> >> hope that helps >> mario >> >>> -- > You received this message because you are subscribed to the Google Groups > "TiddlyWiki" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywiki/2ea136f8-0151-48dc-bf9a-f4a75b7865d4n%40googlegroups.com > <https://groups.google.com/d/msgid/tiddlywiki/2ea136f8-0151-48dc-bf9a-f4a75b7865d4n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMBrJZLTET%3DO-cKpedcLz42iW%2Bukpbscz3caPCvQ%3DwmCGQ%40mail.gmail.com.

