mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Fixed another do_split bug and included a test for the fix.
This commit is contained in:
parent
dbecbccdbc
commit
c5a19f7cdc
3 changed files with 16 additions and 1 deletions
|
@ -244,8 +244,11 @@ Val* do_split(StringVal* str_val, RE_Matcher* re, TableVal* other_sep,
|
|||
--n;
|
||||
}
|
||||
|
||||
if ( num_sep >= max_num_sep )
|
||||
if ( max_num_sep && num_sep >= max_num_sep )
|
||||
{
|
||||
offset = end_of_s - s;
|
||||
n=0;
|
||||
}
|
||||
|
||||
Val* ind = new Val(++num, TYPE_COUNT);
|
||||
a->Assign(ind, new StringVal(offset, (const char*) s));
|
||||
|
|
|
@ -2,3 +2,12 @@
|
|||
[1] = X-Mailer,
|
||||
[2] = Testing Test (http://www.example.com)
|
||||
}
|
||||
{
|
||||
[1] = A ,
|
||||
[6] = =,
|
||||
[4] = =,
|
||||
[7] = D,
|
||||
[5] = C ,
|
||||
[2] = =,
|
||||
[3] = B
|
||||
}
|
||||
|
|
|
@ -6,4 +6,7 @@ event bro_init()
|
|||
{
|
||||
local a = "X-Mailer: Testing Test (http://www.example.com)";
|
||||
print split1(a, /:[[:blank:]]*/);
|
||||
|
||||
a = "A = B = C = D";
|
||||
print split_all(a, /=/);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue