zeek/policy/utils/numbers.bro

10 lines
No EOL
257 B
Text

## Extract the first integer found in the given string.
## If no integer can be found, 0 is returned.
function extract_count(s: string): count
{
local parts = split_n(s, /[0-9]+/, T, 1);
if ( 2 in parts )
return to_count(parts[2]);
else
return 0;
}