I always have trouble making these things work. I enclose groups of text with [[[[group of text]]]] with up to thousands of instances. The very first one may...
22147
Alec Burgess
alecb3ca
Oct 7, 2011 4:35 am
Hi John: This appears to work from Replace dialog - or in a clip Find=\A[^\[]*\K\]{3}.*?92;R Replace=<empty> Note - the \K throws away everything before it (ie....
22148
Sheri
silvermoonwo...
Oct 7, 2011 6:01 am
In case there might be any valid opening brackets in the text prior to the ]]] line that needs deleting: ^!Replace...
22149
John Shotsky
shotsky1
Oct 7, 2011 11:00 am
As a matter of fact, both opening and closing may appear between \A and the wanted removal. Just not multiples. I think this does it, thank you! I have never...
22150
John Shotsky
shotsky1
Oct 15, 2011 2:31 pm
It turns out that this does not do as needed. For reference, there may be, at most, one instance where ]]] is not preceded anywhere in the file by a [[[. That...
22151
Sheri
silvermoonwo...
Oct 15, 2011 5:52 pm
I'm using 6.2 and it works on your sample. You might want to add a prompt to tell you when its done. It will never remove more than one, but I suppose it would...
22152
John Shotsky
shotsky1
Oct 15, 2011 6:25 pm
Ok, thanks. I don't know why, but this one works fine, and the first one didn't. I had already done the bulldozer approach of tagging all the matched ]]]...
22153
Alec Burgess
alecb3ca
Oct 15, 2011 8:26 pm
... Sheri - what does the (*COMMIT) in the above regexp do? (And if possible a link to where it is in PCRE documentation) -- Regards ... Alec (buralex@gmail &...
22154
Sheri
silvermoonwo...
Oct 16, 2011 12:45 am
... Hi Alec, (*COMMIT) says the rest of the pattern must match from here without backtracking. Its in the regex.chm help file in the section on Backtracking...
22155
flo.gehrke
Oct 16, 2011 12:25 pm
... John, I think if it's always the first ']]]' in the string you could just write... ^!Replace "(?s).{1,}?\K\]{3}\R" >> "" WRS The beginning of file is...
22156
flo.gehrke
Oct 16, 2011 12:33 pm
... Sheri, I would be grateful for some more explanations about that verb '(*COMMIT). I've tested your clip... ...
22157
John Shotsky
shotsky1
Oct 16, 2011 1:04 pm
I found some fairly extensive explanations and examples of this and other such verbs in the PCRE text manual. Search for commit to find all the bits. ...
22158
John Shotsky
shotsky1
Oct 16, 2011 2:20 pm
Thanks, Flo, the second example does what is needed. It's also easier for me to understand… :-) Regards, John From: ntb-clips@yahoogroups.com...
22159
flo.gehrke
Oct 16, 2011 2:39 pm
... John, Thanks for that hint, but I can't find an answer there to my question. It appears noticeable that these explanations are rather poor. Maybe they pay...
22160
diodeom
Oct 16, 2011 6:26 pm
... I'd guess you're running this pattern in the (Ctrl+R) dialog box instead of in a clip -- where it's meant to ***capture or fail*** only once (on the very...
22161
Robert Bull
barlennan
Oct 16, 2011 9:12 pm
I have a few clips, and the odd AWK script which works on all the (marked?) text in a file. They seem to be two separate ideas. Is it possible to use scripts...
22162
Sheri
silvermoonwo...
Oct 16, 2011 9:30 pm
... Hi Dio, Flo, everyone, That seems to say it well Dio. In retrospect, this is likely sufficient: ^!Replace "^(?=92;Q]]]92;E|\Q[[[\E)(*COMMIT)\Q]]]\E.*92;R" >> ""...
22163
Sheri
silvermoonwo...
Oct 16, 2011 9:55 pm
... There are some old clipbooks floating around for use with AWK scripts. Have a look and see if they meet your needs. Since these clipbooks were developed...
22164
Larry Hamilton
lm_hamilton
Oct 16, 2011 10:12 pm
Yes. This is a common use. There are some examples of AWK scripts that come with NoteTab. Others have used perl, Java, and others. ~Larry ... [Non-text...
22165
diodeom
Oct 16, 2011 10:13 pm
... I'd consider ^$GetOutput()$ to pass args/variables and get back the results. (For really large blocks of text to process you could just submit the path of...
22166
flo.gehrke
Oct 17, 2011 10:48 am
... Thanks, diodeom! It was clear, however, why the expression fails at line #9. But the question was: Why doesn't it match line #10 and #11? Why doesn't the...
22167
John Shotsky
shotsky1
Oct 17, 2011 12:03 pm
Flo, It turns out that your suggestion fails at times, and takes out ]]] which IS preceded by a [[[ somewhere above it in the text. If [[[ were the first thing...
22168
Sheri
silvermoonwo...
Oct 17, 2011 1:04 pm
Flo, do you remember the \G? I think (*COMMIT) is like that, except the match position within the subject is established dynamically after matching what's...
22169
flo.gehrke
Oct 17, 2011 1:56 pm
... John, No surprise -- I took your message literally. In #22150, you spoke of "one instance where ]]] is NOT preceded anywhere in the file by a [[[. That is...
22170
flo.gehrke
Oct 17, 2011 2:25 pm
... Oh yes, I do remember '\G39;! Great discussion in Oct 2008 (see #18566) Probably, this could explain why, at times, they call '(*COMMIT)' an anchor. Thanks...
22171
Jean-François Colas
jf_colas
Oct 20, 2011 11:27 am
Hi all, Though I'm using NoteTab for years now, I just started diving into the Clip language. Mainly I do some Find/Replace operations with regex. For a...
22172
Eb
ebbtidalflats
Oct 20, 2011 12:29 pm
Hi J-F, What you are asking is remotely possible, but fairly complicated. It probably would be easier to learn to do this completely from the clip, using...
22173
Sheri
silvermoonwo...
Oct 20, 2011 2:28 pm
... I've actually done something like that. Haven't used it in quite awhile, but it does still work. The main clip is used when the "Find" or "Find and Replace...
22174
Sheri
silvermoonwo...
Oct 20, 2011 5:03 pm
Here's a couple more clips to use with the previously posted "Load S-R" clip You will need to fix any long command lines that get wrapped in email when you add...
22175
Jean-François Colas
jf_colas
Oct 21, 2011 10:11 am
Hi all, First, a great thank for all the valuable infos about the Find dialog box. For today, I have a problem with GetDocListAll, which seems not to take...