/Function String = "
%[ ^t]++^(^{method
^}^{class
^}[ ^t]+[a-z0-9_]+^)^{.
^}^{[ ^t]+DEFINITION
^}"
%[ ^t]++ ... start every search at beginning of a line where
0 or more spaces or tabs can exist. In other words the existence of leading whitespaces does not result in a negative match.
^(...
^) ... the string found by the regular expression inside the escaped parentheses is tagged for being displayed in the function list. Everything else matched by the entire expression is ignored.
The UltraEdit regular expression as used here supports up to 9 such capturing groups, but for function list only the first one is evaluated.
With using Perl regular expression it would be also possible to use up to 9 capturing groups, but the difference is that for function list view all strings of the capturing groups would be concatenated with a single space character between all found strings. Therefore it is possible with using Perl regular expression to get more control over what is displayed in function list and how. This special behavior was used for example in the last expressions posted at
Perl regexp function list for C# to have always exactly 1 space between name of a function and its parameters independent on how many spaces/tabs exist really between function name and opening parenthesis. The Perl regular expression supports also non capturing groups as you can see in referenced post.
^{method
^}^{class
^} ... is an OR expression for the two words
method and
class. So the first word on a line must be either
method OR
class in any case for a positive match as the regular expression searches are always executed not case-sensitive.
The UltraEdit and the Unix regexp engines support only OR expressions with exactly two arguments. The Perl regexp engine supports much more as it can be seen in the referenced post. With Perl regular expression engine it would be also possible to change behavior regarding case-sensitivity for each search expression if that is really needed.
[ ^t]+ ...
1 or more spaces or tabs must exist after either string
method or string
class.
[a-z0-9_]+ ... the name of a method or class must be found next consisting only of letters (in any case), digits or underscores. At least 1 of those characters must be found. In C/C++ and many other languages a better expression would be
[a-z_][a-z0-9_]++ as the first character cannot be a digit for a valid function/method/class name.
Now we would have already found the name of a class or method. But we want to avoid duplicates in function list view because of definition and implementation of a class. Therefore one more OR expression must be applied for a positive match of the search.
^{.
^}^{[ ^t]+DEFINITION
^} ... the next character must be either a dot for methods OR after 1 or more spaces/tabs the word
DEFINITION (in any case) for classes.
Of course false positives on invalid method/class definitions would be possible with this regular expression. But the main target for the function string regular expression is to find as quickly as possible the strings of interest and not checking syntax of the source file with ignoring all invalid definitions if that would result in more complex expressions and therefore slower searches.