## Re: [Clip] Re: Twos and Threes

Expand Messages
• Hello Flo This is incredible: indeed yes it is what is wanted. ^!Replace ^.* b(HL|SF|LS|CC|HW|HF|NB) b.*\$ r n\$0 r n WARS ^!Replace R{3} r n
Message 1 of 10 , May 26, 2013
Hello Flo

This is incredible: indeed yes it is what is wanted.

^!Replace "^.*\b(HL|SF|LS|CC|HW|HF|NB)\b.*\$" >> "\r\n\$0\r\n" WARS
^!Replace "\R{3}" >> "\r\n" WARS
^!Replace "^\A\R|\R{1,}\Z" >> "" WARS

How do you actually explain such lines? The point about code with loops and all that is you go down the list and follow the logic, once you've pulled hair out via the Help pages ( "Grr, give an example of how you write it!" is what I say there) or seen how other clips do it and got the code lines to work. Often the practical way is clips that follow menus and those keyboard macros that are somewhat sluggish and unreliable.

I've looked at the regex pages and notions such as "greedy" mean nothing to me.

Once again many thanks are due.

http://www.pluralist.co.uk
http://pluralistspeaks.blogspot.com
pluralist@...
26-05-2013
----- Received the following content -----
From: flo.gehrke
Time: 2013-05-26, 13:21:33
Subject: [Clip] Re: Twos and Threes

[Non-text portions of this message have been removed]
• ... How do you actually explain such lines? Adrian, Let me just give you an explanation for the first command line: Find ^.* b(HL|SF|LS|CC|HW|HF|NB) b.*\$ ...
Message 2 of 10 , May 26, 2013
--- In ntb-clips@yahoogroups.com, "Adrian Worsfold"<pluralist@...> wrote:
>
> ^!Replace "^.*\b(HL|SF|LS|CC|HW|HF|NB)\b.*\$" >> "\r\n\$0\r\n" WARS
> etc...

How do you actually explain such lines?

Let me just give you an explanation for the first command line:

Find '^.*\b(HL|SF|LS|CC|HW|HF|NB)\b.*\$'...
^ = start of line
.* = any character (except NL), zero or more times
\b = word boundary (between word character and non-word character)
(HL|...|NB) = alternation (a OR b OR c etc)
\b = another word boundary
.* = again any character till...
\$ = end of line

And replace with...
\r\n = CRNL
\$0 = the whole match
\r\n = another CRNL

From a stricter point of view, one would write:

^.+?\b(?:HL|SF|LS|CC|HW|HF|NB)\b.+\$

This is a bit more efficient though, with a few lines, one would hardly notice the difference. At the start of each line, we see at least one character being different from '(HL|...|NB)'. So it makes no sense to search for 'zero'. It's the same condition at end of lines where we've got time data.

Since there's nothing to store, the alternation could be defined as non-capturing with '?:'. So you may want to replace the RegEx in the above mentioned command line with this better version.

> Once again many thanks are due.

It's been a pleasure! It keeps me in practice. I also like the precise requirements you are posting, and the good feedback you give including a full view of what comes out in the end.

Regards,
Flo
• Hello Flo (and others) I made a feature of these requirements on my blog too, and has concerned the last four entries, at http://pluralistspeaks.blogspot.com
Message 3 of 10 , May 26, 2013
Hello Flo (and others)

I made a feature of these requirements on my blog too, and has concerned the last four entries, at

http://pluralistspeaks.blogspot.com

because that then links through to my Facebook pages and the people who, sometimes, also use CDs for music in services. I try to do a 'best practice' offering in collecting, editing and storing hymns and acquiring and using incidental music.

From this I have also made a list maker clip for my own CDs to produce a similar looking list, but different titling and file saving.

I do put my clipbooks out for others to use, and who knows who looks and gets the drift. They are on my website and the link page to them is now at https://dl.dropboxusercontent.com/u/28120070/pluralist/learning/ictlinks.html for that part that was neglected a little until recently.

http://www.pluralist.co.uk
http://pluralistspeaks.blogspot.com
pluralist@...
27-05-2013
----- Received the following content -----
From: flo.gehrke