Regex - Can you return the matched pattern using sub?

Jonah Burgess <[email protected]>
Newsgroups gmane.comp.security.detection.bro
Message-ID <AM6PR07MB5303EC57163EE7D66205BA208EAD0@AM6PR07MB5303.eurprd07.prod.outlook.com>
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

_______________________________________________
Zeek mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/zeek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.