There could be used for a
hierarchical function list the following find strings definition:
Code: Select all
/TGBegin "Tool Calls"
/TGFindStr = "^[0-9]+[\t ]+TOOL[\t ]+CALL[\t ]+([0-9]+)"
/TGFindStr = "^[0-9]+[\t ]+TOOL[\t ]+CALL[\t ]+"([^\r\n"]+?)""
/TGBegin "Other"
/TGFindStr = "^[0-9]+[\t ]+\* - {3}(.+)$"
/TGFindBStart = "TOOL[\t ]+CALL"
/TGFindBEnd = "(?:TOOL[\t ]+CALL|\z)"
/TGEnd
/TGEnd
/Regexp Type = Perl
For each
TOOL CALL found in the active file is searched next in the block from this
TOOL CALL to either next
TOOL CALL OR end of file referenced with
\z for a line with a line number and
* - and exactly three normal spaces and listing everything after the three spaces on these lines in the subgroup
Other of the current
TOOL CALL. There should be of course used a better name for the inner function strings than
Other.
The function list can be sorted alphabetically or unsorted on using this function string definition.
More simple is:
Code: Select all
/TGBegin "Tool Calls"
/TGFindStr = "^[0-9]+[\t ]+TOOL[\t ]+CALL[\t ]+([0-9]+)"
/TGFindStr = "^[0-9]+[\t ]+TOOL[\t ]+CALL[\t ]+"([^\r\n"]+?)""
/TGFindStr = "^[0-9]+[\t ]+\* -( {3}.+)$"
/TGEnd
This produces a
flat function list. But in this case the option
Sort list must be toggled off in the context menu of the
Function List view as otherwise it is not visible which string after
* - and exactly three spaces belongs to which
TOOL CALL block.
The UltraEdit regular expression
%*^{[^}^{[^} is not good although it looks like it worked somehow for you. It means start each search at the beginning of a line, find zero or more characters except newline characters non-greedy followed by an opening square bracket OR an opening square bracket. The OR expression
^{…
^}^{…
^} makes no sense on specifying twice the same string. Another issue here is that
[ is also in UltraEdit syntax the beginning of a character class definition and needs to be escaped with
^ for being interpreted as literal character. I am really wondering that you get strings in the function list displayed with that UltraEdit regular expression at all as when I run it manually from the
Find and Replace dialog window, it does not find the lines as shown on the attached image at all.
There can be used in Perl syntax the following to find any string within the
first pair of opening and closing square brackets on a line.
Code: Select all
/TGBegin "Squared strings"
/TGFindStr = "^[^\r\n[]*\[([^\r\n\]]+)\]"
/TGEnd
The escape character in a Unix/Perl regular expression is
\ instead of
^ as in an UltraEdit regular expression. The character
[ is interpreted as beginning of a character class definition, except it is escaped with
\ to be interpreted literally or the opening square bracket is used inside a character class definition like the first character class definition in the search expression above. The character
] is interpreted literally by default, except a character class definition is opened where it marks the end of the character class definition.The character
] must be escaped with
\ if this character should be one of the characters of the character class definition.
The expression must be read as follows:
^ … start each search at the beginning of a line.
[^…
] … that is a
negative character class definition because of
^ after the opening square bracket beginning the character class definition to find a character which is NOT one of the characters defined next.
\r\n[ … There should be found a character which is NOT a carriage return, NOT a line feed and NOT an
opening square bracket.
There is applied to the negative character class definition the multiplier
* which means
zero or more times (greedy which is not relevant here). So the first negative character class definition with multiplier
* matches
zero or more characters in a line up to either finding an opening square bracket or a new line character or reaching the end of the file.
\[ … there must be found next literally the character
[ for a positive find. If there is a newline character like carriage return or line feed or the end of the file is reached, the find is negative for this line resulting in stopping the search for this line and ignoring the line without an opening square bracket.
( … begins the capturing group to define which part of the entire found string should be displayed in the function list. The opening round bracket can be moved left to
\[ to get the opening square bracket also displayed in the function list as with the function string definition below.
[^\r\n\]]+ … is again a negative character class definition to find a character which is NOT a carriage return, NOT a line feed and NOT a
closing square bracket (instead of an
opening square bracket) with the multiplier
+ for
one or more such characters. In other words a line with
[] as first square brackets pair with no characters between the two square brackets is ignored as the entire expression is not positive for such a line.
) … ends the capturing group to define which part of the entire found string should be displayed in the function list. The closing round bracket can be moved right to
\] to get the closing square bracket also displayed in the function list as with the function string definition below.
There must be found next
] for a positive match. A line with having just
[ but no
] is ignored for that reason.
The function string definition with the square brackets also displayed in the function list is:
Code: Select all
/TGBegin "Squared strings"
/TGFindStr = "^[^\r\n[]*(\[[^\r\n\]]+\])"
/TGEnd
Well, easier to read and also working is:
Code: Select all
/TGBegin "Squared strings"
/TGFindStr = "^.*?\[(.+?)]"
/TGEnd
.*? … matches any character except newline characters
zero or more times non-greedy. This expression matches also all characters (from the beginning of a line) up to
first occurrence of
[ specified next in the expression.
.+? … matches any character except newline characters
one or more times non-greedy. This expression matches also all characters (after
[) up to
first occurrence of
] specified next in the expression.
The function string definition with the square brackets also displayed in the function list.
Code: Select all
/TGBegin "Squared strings"
/TGFindStr = "^.*?(\[.+?])"
/TGEnd
Which of the four variants is used is up to you. They all find the same string without or with the square brackets for the function list.
Last, a special hint: Save a screenshot showing text as PNG or WEBP image. Both are supported by web browsers and many other applications (especially PNG) and use a lossless compression producing for a screenshot nevertheless a much smaller file than the JPG image format.