[Zeek] Regex - Can you return the matched pattern using sub?

Jonah Burgess jburgess03 at qub.ac.uk
Wed Aug 14 04:12:00 PDT 2019


Hi,

Can I replace a pattern in a string with “” but also return the matched pattern?

Basically I am extracting different blocks of text from a string using match_pattern() but then at the end, I want to search all the remaining text (minus the blocks that were already extracted).

I tried simply calling gsub(data, pattern, “”) just after calling block[n] = match_pattern(data, pattern) but this didn’t seem to benefit performance at all. I’m sure there must be a better way :/

Thanks in Advance,
Jonah


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/zeek/attachments/20190814/4332304e/attachment-0001.html 


More information about the Zeek mailing list