Trying to insert a couple of lines at the top of multiple documents.
I have managed to find the top of the document, but in inserting the text I am running into a problem adding a ‘new line’ in-between the two lines, and at the end of the two lines.
Tried many combinations of \n and \r etc. (on a Mac) with and without quotes and apostrophes, but so far none of the combinations work. The text is inserted, but all on one line.
The reason it fails is that S-N-R in Tiddler Commander does not support meta-characters in REPLACE, though supports them all in MATCH.
There is a trick, if you are familiar with regex, you can use with a “capturing group” to grab an “\n” from the original and then use that capture in the replace.
Here is an example (using plain text) …
Match: “^.+(\n)” ------ set SNR to “first match”
Replace: “New para ONE.$1$1New para TWO.$1$1$&”
In the replace “$1” is the captured “\n” re-inserted as often as needed. And the “$&” the full string of the original match.
I have often used the $1 in replace regex, but in this particular example I was simply moving the cursor to the beginning of the document and inserting text, so there were no new line characters to capture to begin with.