Cleanup and extend the regex for matching expert info entries.

Match each entity in the structure explicitly rather than skipping a bunch at
the end.  This makes it possible to easily (and clearly) specify where we
allow white space.

Don't capture the event group and severity: we don't use them anyway.

Don't put single character matches in []: that makes it hard to read (for
me anyway).

There's no need for both the "m"(ultiline) and "s"(ingle line) options.  Nor
the "o"optimize (make buggy) option.

These same changes should/will be applied to the hf regex later.

Change-Id: I3bf307dcd6432eb1a0c2b9aceea201f8403e08c0
Reviewed-on: https://code.wireshark.org/review/16313
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Jeff Morriss 2016-07-05 20:15:09 -04:00 committed by Anders Broman
parent 448c89e30b
commit aa9f560853
1 changed files with 17 additions and 19 deletions

View File

@ -639,34 +639,32 @@ sub find_remove_ei_array_entries {
# ei[] entry regex (to extract an ei_index_name and associated field type)
my $ei_array_entry_regex = qr /
[{]
{
\s*
& \s* ( [a-zA-Z0-9_]+ ) # &ei
(?:
\s* [[] [^]]+ []] # optional array ref
\s* [ [^]]+ ] # optional array ref
) ?
\s* , \s*
[{]
[^}]+
, \s*
(PI_[a-zA-Z0-9_]+) # event group
\s* , \s*
(PI_[a-zA-Z0-9_]+) # event severity
\s* ,
[^}]+
, \s*
(?:
{
# \s* "[^"]+" # (filter string has been removed already)
\s* , \s*
PI_[A-Z0-9_]+ # event group
\s* , \s*
PI_[A-Z0-9_]+ # event severity
\s* ,
[^,]* # description string (already removed) or NULL
, \s*
EXPFILL
)
[^}]*
\s*
}
\s*
}
[\s,]*
[}]
/xmso;
/xs;
# find all the ei[] entries (searching ${$code_ref}).
while (${$code_ref} =~ m{ $ei_array_entry_regex }xmsog) {
($debug == 98) && print "+++ $1 $2\n";
while (${$code_ref} =~ m{ $ei_array_entry_regex }xsg) {
($debug == 98) && print "+++ $1\n";
$ei_array_entries_eiref->{$1} = undef;
}