Re: [Clip] Re: modifying format of stats tool output & concatenating stats from many files
> Hi Don, I've missed you!Guest appearance ;-) Prodigal son?
> "(?=" signifies a lookahead assertion. There is an equal sign inside the look ahead assertion, (?=\=). It may not need that backslash, but it makes it easier to see (at least for me). So, an equal sign must follow (looking ahead) the %xxx% to be a match. The equal sign is not actually part of the matched text.Look ahead and look back assertions are currently over my head -- I need
to solve that. It's funny in one way because regex won't search
backwards, but it will look back ...
So that bit that kind of looks like a rear end ... (?=\=) ... really is
just to say "followed by an equals sign." It has three characters (?=
to say look ahead ... find an equals sign (escaped for good measure) and
If we wanted the search pattern followed by a letter R it would be (?=R)
if I follow correctly ... can it also accept or patterns (?=r|R) and so
- On 3/2/2010 8:56 AM, diodeom wrote:
> "Sheri"<silvermoonwoman@...> wrote:LOL. I'm deleting the line, this clip doesn't even create an array for
>> I wrote:
>>> And I'd guess ^!Set %varnames%="" may be a leftover from
>>> before :Clear existed?
>> There is this in the docs:
>> "If you assign an empty value to an array variable, or use the
>> ^!Set command to assign a new value to it, the array is
>> automatically removed from memory."
>> ... so out of an abundance of caution, I set the array variable
>> equal to empty string before using ClearVariable on it.
> My overly concise suggestion didn't imply it well: it was because I'm aware of what setting a variable to empty does — and of your high standards — that I assumed you didn't mean to do the same thing twice. I speculated that maybe as you were writing this clip, initially ^!Set %varnames%="" was the last line, and after adding a provision for cases where no variables are captured, which called for a label :Clear, its removal was overlooked (or an alternative of just placing the label right above it). Sorry, Sheri; I'm sure it's not the last time I guessed incorrectly. (I'm also quite certain it won't stop me from trying... :)
varnames. Probably an earlier version did. Will try to pay better
attention next time.
- Sheri (silvermoonwoman@...) wrote (in part) (on 2010-03-01 at
> Maybe it would help to know that that clip is meant to be run from theI was on holiday (got back yesterday) and am just noodling thru the
> clipbar while clipedit is the active document. It shows the names of
> variables found in clip currently being edited. GetDocListAll gives
> the opportunity to format the matches, so they are formatted with the
> ClearVariable command in front of each one. The purpose is just to
> help make the list of ClearVariable commands needed to clear only the
> variables actually Set by the clip being written.
> It only finds %xxx% if:
> - it follows a line start followed by ^!Set or ^!SetCode or ^!SetArray
> and one space, OR if it follows a semicolon (anywhere on a line) plus
> an optional space
> - it is followed by an equal sign
large number of posts during the past week.
I read this thread but didn't test any of the example code.
> > > ^!Set %varnames%="Sheri: wrt to your "find variables for clearing" clip. You appear from
the comments but haven't checked the regex itself, to be expecting a
variable xxx to be defined as:
Following works though I use the construct without %...% only
accidentally :-[ :
Will your clip capture this usage?
> "(?=" signifies a lookahead assertion. There is an equal sign inside
> the look ahead assertion, (?=\=). It may not need that backslash, but
> it makes it easier to see (at least for me). So, an equal sign must
> follow (looking ahead) the %xxx% to be a match. The equal sign is not
> actually part of the matched text.
> The search is case insensitive so that ^!set works as well as ^!Set or
> any other mixed case that might be found.
Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
[Non-text portions of this message have been removed]
- --- In email@example.com, Alec Burgess <buralex@...> wrote:
>No, of course not. :)
> Sheri (silvermoonwoman@...) wrote (in part) (on 2010-03-01 at
> > ^$GetDocListAll("(?i)(^\^\!Set(Array|Code)?\x20|;\x20?)\K%[\d\pL_]+?%(?=\=)";"^!ClearVariable
> > $0\r\n")$"
> Sheri: wrt to your "find variables for clearing" clip. You appear
> from the comments but haven't checked the regex itself, to be
> expecting a
> variable xxx to be defined as:
> ^!set %xxx%=asdf
> Following works though I use the construct without %...% only
> accidentally :-[ :
> ^!set xxx=asdf
> ^!info ^%xxx%
> Will your clip capture this usage?
But (sigh) I suppose by failing to capture them, it is remotely possible that some "accidental" variables would fail to get released.
So perhaps it would be better to modify the capture part as follows:
^!Set %varnames%="^$GetDocListAll("(?i)(^\^\!Set(Array|Code)?\x20|;\x20?)\K(%?)([\d\pL_]+?)\3(?=\=)";"^!ClearVariable %$4%\r\n")$"